search for: more_than_100_given_away

Displaying 1 result from an estimated 1 matches for "more_than_100_given_away".

2008 Jul 23
3
Validation method vs. After Save & Rollback
...re (as a percentage) of the company. The total shares for any one company can not be more than 100%. So if I have 10 owners each with 10% of the company and I update one of the owners and set their share to 11%, I should be given a warning message. This is what I have done in my Owner model: def more_than_100_given_away? # => find the total share company = Company.find(company_id) company_total_share = company.total_share # => This is summing the old value if changed? if changes["share"] # => Changes to a model are stored in the changes array on the instance, the array has 2 value...