This project is archived and is in readonly mode.

#698 ✓resolved
Daniel Guettler

has_one through with new value nil

Reported by Daniel Guettler | July 24th, 2008 @ 08:06 PM | in 2.x

I ran into this when I tried to set a has_one through association to nil. ActiveRecord correctly removed the through association from the database but then it tried to create a new association using nil as associate.

class Member < ActiveRecord::Base
  has_one :current_membership
  has_one :club, :through => :current_membership

class CurrentMembership < Membership
  belongs_to :member
  belongs_to :club

class Club < ActiveRecord::Base
end = nil

Attached a patch with failing test and possible fix.

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=""></a>

People watching this ticket

Referenced by