On 8/30/06, Chris Wanstrath <[EMAIL PROTECTED]> wrote:
So, if this `find!' bidness gets introduced it means an exception can
get raised a) on record not found via find! / find_by_*!  or b) on
record not found via find(id).  Raised on bangs or on non-bang.

I know the non-bang is a very specific circumstance, but does this
bother anyone else?  I suppose one way of looking at this is that the
bang methods are just sugar for existing methods, none of which
change.  But it sure would be nice to just say "methods with a bang
raise an exception on blank, methods without do not."

I can deal with it; I love that this change is being discussed.  But
won't someone think of the children?

I remarked earlier that I think it's a good indication that there should be separate 'loading' and 'finding' API.  Find is way overloaded, though that can be valuable trait, as with Ruby's relatively small set of builtin collection classes each serving many needs.

Perhaps:
  Person.load(1)
  Person.load_by_name('bob')
meaning "give me the record that I've uniquely identified for you" versus
  Person.find_by_name('bob')
meaning "look for records matching the criteria I've given and return the first one"

jeremy

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to