Is there a callback directly after an object is fetched? In WebObjects we had numerous opportunities to perform actions on database objects when they were fetched or inserted, awakeFromFetch or awakeFromInserttion. I see in the documentation before_create, before_destroy, before_save, etc. How would one perform a method after fetching the object but before utilizing that object? -- Thanks. Lon
> Is there a callback directly after an object is fetched?You have two. There''s after_initialize, which is always called whether a new object is created with #new or #find*, and then there''s after_find, which is only called for the latter. -- David Heinemeier Hansson, http://www.basecamphq.com/ -- Web-based Project Management http://www.rubyonrails.org/ -- Web-application framework for Ruby http://macromates.com/ -- TextMate: Code and markup editor (OS X) http://www.loudthinking.com/ -- Broadcasting Brain
Try ''after_initialize''. Hope that helps. On Sun, 5 Dec 2004 20:39:46 -0500, Lon Baker <lon-JCsVN+o+Xp98UrSeD/g0lQ@public.gmane.org> wrote:> Is there a callback directly after an object is fetched? > > In WebObjects we had numerous opportunities to perform actions on > database objects when they were fetched or inserted, awakeFromFetch or > awakeFromInserttion. > > I see in the documentation before_create, before_destroy, before_save, > etc. How would one perform a method after fetching the object but > before utilizing that object? > > -- > Thanks. > Lon > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Regards, John Wilger ----------- Alice came to a fork in the road. "Which road do I take?" she asked. "Where do you want to go?" responded the Cheshire cat. "I don''t know," Alice answered. "Then," said the cat, "it doesn''t matter." - Lewis Carrol, Alice in Wonderland
John and David, Thanks! I did not see those listed in the documentation at ar.rubyonrails.org, I guess need to go download the latest version of the documentation. David I attended your presentation in San Francisco and have to thank you so much for Rails! -- Lon Baker