You may be interested in the Money gem here’s a dodgy link to the docs http://gemjack.com/gems/money-1.7.1/index.html.
Anyway overriding ActiveRecord accessors is not exactly the same than
rewriting generic ruby accessors.
try something like this
def unit_price=(price)
write_attribute :unit_price, price.to_i
end
You may be interested in the Money gem here’s a dodgy link to the docs http://gemjack.com/gems/money-1.7.1/index.html.
Anyway overriding ActiveRecord accessors is not exactly the same than
rewriting generic ruby accessors.
try something like this
def unit_price=(price)
write_attribute :unit_price, price.to_i
end
Nice. I’ll definitely check out that money gem. I guess that makes
sense about active record accessors. Thanks!
Matt
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.