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.

has_one natural assignment to already associated record

#854

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.

Reported by qoobaa · August 18th, 2008 @ 08:47 PM

State: resolved
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. qoobaa
    qoobaa
    • Tag changed from 2.1, activerecord, bug to 2.1, activerecord, bug, patch, tested

    I've fixed the bug and created a simple test_has_one_natural_assignment_to_already_associated_record.

    August 21st, 2008 @ 12:04 PM

  2. qoobaa
    qoobaa
    • Title changed from has_one unexpected behaviour to has_one natural assignment to already associated record

    August 21st, 2008 @ 12:07 PM

  3. Repository
    Repository
    • State changed from new to resolved

    (from [ea40f71431a821b2ddb37be6ea3ee7d8dac63b85]) Fix that has_one natural assignment to already associated record. [#854 has_one natural assignment to already associated record state:resolved]

    Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...

    August 21st, 2008 @ 03:30 PM

  4. Repository
    Repository

    (from [2242d3faf12dfc381850e2269016dd4ba95bad86]) Fix that has_one natural assignment to already associated record. [#854 has_one natural assignment to already associated record state:resolved]

    Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...

    August 25th, 2008 @ 09:30 AM