Can anybody share some examples of their Money implementation ?
I’m trying to setup a Model to use this library, but can’t seem to wrap
head around how it is exactly supposed to work.
My Model (Foo) looks like:
composed_of :commission, :class_name => “Money”, :mapping => [
%w(commission_cents cents), %w(commission_currency currency) ]
Yet, in script/console, I’m unable to get the correct behaviour (at
think), from the library.
t = Foo.new(:commission => 34)
NoMethodError: undefined method
cents' for 34:Fixnum from (eval):3:incommission=’
I’ve tried just playing with the Money object as well, but regardless of
what number I pass into the Money constructor, it always provides me
the exact number I specify as the “cents” value. So, If I do:
34.43)… it tells me that the instance has 34 cents.
I must be overlooking something. Any insight would be greatly