> If the title is a valid alternate key and you have made sure you have > a unique constraint in your database, you can use this to get the > object with a specific title: > > Post.find_by_title(title).first
Actually Post.find_by_title(title) will not return an array, just a single object, so the 'first' is invalid. Post.find_all_by_title(title) will return an array, however --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" 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/rails-oceania?hl=en -~----------~----~----~----~------~----~------~--~---
