Yeah I agree with Paul that :unique is a bit misleading. Also, I'm not sure if I've had a case using .first() where it'd matter if there were more than one matching row. Could you mention your actual use cases ?
Thanks. On Thu, Jul 30, 2009 at 6:22 PM, Joris<[email protected]> wrote: > > Hi guys, > > Pratik pointed me here. I have submitted feature request #2974. > > It's basically a new finder: unique. To be used at times where people > use :first. > Often, you query for something, and expect only a single record. > > To do this, people use :first. However, :first does not check for any > following entities. This means that if the developer expects 1 > records, and gets more than 1 the application will 'just work'. > > I don't think this is correct behaviour. Also, :first and :last mean: > first / last of the list. If you're looking for a single row, unique > makes more sense > > > > -- Cheers! - Pratik 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 -~----------~----~----~----~------~----~------~--~---
