Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias_method :save_new, :save
- def save
- ability = Ability.find :first, :conditions => ['character_id = ? AND skill_id = ?', self.character.id, self.skill.id]
- if ability
- errors.add_to_base("not enough build") unless self.skill.enough_build?(self.character.tfb, self.quantity)
- ability.quantity += self.quantity
- ability.save_new
- else
- self.save_new
- end
- end
Add Comment
Please, Sign In to add comment