Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

using 'find_or_create_by' with multiple attributes through an association

#5223

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

Reported by Jon Buda · July 28th, 2010 @ 02:16 AM

State: committed
Milestone: 3.0.2
Assigned to: Santiago Pastorino Santiago Pastorino
Importance: Low

Activity

  1. Santiago Pastorino
    Santiago Pastorino
    • Assigned user set to Santiago Pastorino
    • State changed from new to committed
    • Milestone cleared.
    • Importance changed from to Low

    July 28th, 2010 @ 04:49 AM

  2. Jeremy Kemper