What's wrong with: Model.find(:all, :limit => 2).size
If size > 1 you know there's more than 1 record in the database On Jul 30, 1: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 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
