I would put your class Currency in a file under "apps/models/
currency.rb"
It should load the file currency.rb file automatically, since it''s in
the models folder.
On Aug 19, 7:46 pm, dparkmit
<dpark...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi All,
>
> Here''s a n00b question forcomposed_of. In what file do you put
the
> class that is used for thecomposed_of?
>
> For example, let''s say that you have the code below:
>
> class Declaration < ActiveRecord::Base
> composed_of:amount, :class_name => "Currency", :mapping =>
> %w(amount amount)
> end
>
> class Currency
> attr_accessor :round, :decimal, :amount
>
> def initialize(amount)
> self.amount = amount
> self.round = amount.to_i.to_s[0..-3]
> self.decimal = amount.to_i.to_s[-2..-1]
> end
>
> end
>
> In what file do you put the code for the class Currency? Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---