This project is archived and is in readonly mode.

#6251 new
ronin-131274 (at lighthouseapp)

has_one through incorrect id add

Reported by ronin-131274 (at lighthouseapp) | January 5th, 2011 @ 05:15 AM

class Device < ActiveRecord::Base
has_many :units has_many :components, :through => :units end

class Component < ActiveRecord::Base
has_one :unit has_one :device, :through => :unit end

class Unit < ActiveRecord::Base
belongs_to :device belongs_to :component end

Everything I add a device_id to a component, it adds 1 to the device_id stored in the Units table.

x=Component.new
x.device=1
x.save

device_id=2 in the Unit model

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

Pages