This project is archived and is in readonly mode.

#5983 new
Szymon Nowak

find_or_create_by doesn't work with protected attributes

Reported by Szymon Nowak | November 16th, 2010 @ 01:16 PM

There's some strange problem with find_or_create_by on has_many associations and protected attributes:
user.posts.find_or_create_by_some_protected_attribute doesn't assign "some_protected_attribute", but user.posts.find_or_initialize_by_some_protected_attribute does.

I'm attaching a failing test case.

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>

Attachments

Pages