On Mar 26, 12:26 pm, Yajiv
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Having a class
>
> class Recipe <ActiveRecord
>
> def initialize
> super()
> @someingredients =["salt"]
> end
>
> end
>
> It appears that
>
> Recipe.find(:all)
>
> returns recipes who haven''t been ''initialized''
>
> How do you setup a suitable initial state when using these finders?
ActiveRecord uses allocate instead of initialize when you find a
records from the database. It does this for performance reasons and
also for data integrity.
Please see http://gr-ruby.org/2006/1/18/activerecord-instantiation-magic
Zach
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---