Hi All,
In my Account model I have a composed_of declaration like this:
class Account
composed_of :balance, ... do |value|
Money.new(value, ''USD'')
end
end
I would like to modify this so instead of always creating a USD, the
currency can be inferred from the ''currency'' field in account.
That
is,
class Account
composed_of :balance, ... do |value|
Money.new(value, currency)
end
end
Of course, this wouldn''t work since Account#currency is not within the
block''s scope. Is there anyway for me to access Account#currency
within the composed_of block? Something akin to has_many''s
proxy_owner object.
Thanks,
Eric
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---