From: Frederick Cheung Date: 2008-08-09T00:45:37+09:00 Subject: Re: Still missing the boat on class/instance methods On 8 Aug 2008, at 15:42, Jeff wrote: > On Aug 5, 5:30 am, "David A. Black" wrote: >> ActiveRecord overrides #find for its association collections, so >> you'd >> have to use #detect, or a :conditions clause on the find. > > It's one of the few things that make me cringe about Rails - some > native Ruby things are changed when they shouldn't be. > The association proxy isn't an Array, so an association proxy having it's own find is no different that one of your classes implemeneting a [] method > I wonder if I could submit a patch to make #find, when given only a > block, fall back to "normal" Ruby usage. One way out is some_activerecord_object.some_collection.to_a.find Fred > > > I shall investigate :-) > > Jeff > > REST with Rails, Oct 4, 2008, in Austin, TX: > http://www.purpleworkshops.com/workshops/rest-and-web-services > >> David >> >> -- >> Rails training from David A. Black and Ruby Power and Light: >> * Advancing With Rails August 18-21 Edison, NJ >> * Co-taught by D.A. Black and Erik Kastner >> Seehttp://www.rubypal.comfor details and updates! >