This project is archived and is in readonly mode.

#854 ✓resolved
qoobaa

has_one natural assignment to already associated record

Reported by qoobaa | August 18th, 2008 @ 08:47 PM | in 2.x

Example from the http://www.simpltry.com/2008/07/... :


>> user = User.first
=> #<User id: 1>
>> user.email = Email.find(user.email.id)
=> #<Email id: 1, user_id: 1>
>> user.reload
=> #<User id: 1>
>> user.email
=> nil

I've spent over two hours on debugging it in my code (I used callbacks to associate objects). It's really surprising - I think it's not the obvious and expected behaviour.

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

Referenced by

Pages