Displaying 1 result from an estimated 1 matches for "new_total_share".
2008 Jul 23
3
Validation method vs. After Save & Rollback
...ot;share"] # => Changes to a model are stored in the
changes array on the instance, the array has 2 value ["from_value",
"to_value"]
old_value = changes["share"][0].to_f # => Convert To Float
new_value = changes["share"][1].to_f
new_total_share = company_total_share - old_value + new_value
new_total_share > 100.01
else
false # validation succeeds
end
else
false # validation succeeds
end
end
It is working for me just fine, but I wanted to know if there was a
better (less NOOB looking way to do this)
T...