This project is archived and is in readonly mode.

#5223 ✓committed
Jon Buda

using 'find_or_create_by' with multiple attributes through an association

Reported by Jon Buda | July 28th, 2010 @ 02:16 AM | in 3.0.2

While using find_or_create_by with multiple attributes through a has many assocation, attributes were being joined by 'and' and not 'and' causing it to fail if the record didn't exist.

ie.

  author.posts.find_or_create_by_title_and_body('the title', 'the body')

would try to call find_or_create_by_titlebody

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Pages