It's a widely used technique already actually. Check http://weblog.jamisbuck.org/2007/4/4/activerecord-base-find-shortcut and comment section there to see why it's not in core.
Thanks, Pratik On 7/16/07, Hampton <[EMAIL PROTECTED]> wrote: > > I've got a patch working for this and wanted to know the core-team's > opinion on this feature-add. I often find myself wanting to do finds > with id's and having the natural urge do to this. > > User[12] #=> User.find(12) > > Asking the User < ActiveRecord::Base object to give me an "index" on > it... aka, the primary key... aka, the id. > > Any interest in this as a nice little shorthand? I'm asking here > before making an actual-patch because I know that changes to > ActiveRecord API are serious and I wanted to get opinions first. > > -hampton. > > > > -- http://m.onkey.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
