Guest User

Untitled

a guest
Feb 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. alias_method :save_new, :save
  2.  
  3. def save
  4. ability = Ability.find :first, :conditions => ['character_id = ? AND skill_id = ?', self.character.id, self.skill.id]
  5. if ability
  6. errors.add_to_base("not enough build") unless self.skill.enough_build?(self.character.tfb, self.quantity)
  7. ability.quantity += self.quantity
  8. ability.save_new
  9. else
  10. self.save_new
  11. end
  12. end
Add Comment
Please, Sign In to add comment