Displaying 1 result from an estimated 1 matches for "shape_id".
Did you mean:
shape_3d
2007 Dec 06
0
has_many :through with a has_one source
...uot;, :force => true do |t|
t.column :name, :string
end
create_table "shapes", :force => true do |t|
t.column :name, :string
t.column :container_id, :integer
end
create_table "colors", :force => true do |t|
t.column :name, :string
t.column :shape_id, :integer
end
end
class Container < ActiveRecord::Base
has_many :shapes
has_many :colors, :through => :shapes
end
class Shape < ActiveRecord::Base
has_one :color
end
class Color < ActiveRecord::Base
end
container = Container.create! :name => "Container 1"
shape1...