search for: to_value

Displaying 2 results from an estimated 2 matches for "to_value".

2009 Jul 16
9
Please help me understand how arrays are translated in rails
...it rather than the way I have been trying to do it: Summary: Rake task is being used to pull data, calculate data, and save data. In my rake file I am performing the following: update_tsos_offense = TsosOffense.new update_tsos_offense.calculate_tsos(TotalOffense, "ydspgm", to_team_id, to_value) This creates a new object in TsosOffense. The method it''s calling is the one I posted above that I''m having some difficulties with. I''m supplying the model name, the field, a variable to store the team_id in, and a value to store the field information in. I was going...
2008 Jul 23
3
Validation method vs. After Save & Rollback
...e 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 ["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 els...