Skip to content

Instantly share code, notes, and snippets.

@joho
Created January 12, 2009 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joho/45836 to your computer and use it in GitHub Desktop.
Save joho/45836 to your computer and use it in GitHub Desktop.
# http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M002047
class Item < ActiveRecord::Base
before_save :tidy_up_vals
def tidy_up_vals
self.price = Money.new(price_before_type_cast.to_i * 100)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment