I have a model defined as
class A < ActiveRecord::Base
belongs_to :b
belongs_to :c
end
How do I create a new instance of A associated with both b and c. I've got the ids for b and c.
I have a model defined as
class A < ActiveRecord::Base
belongs_to :b
belongs_to :c
end
How do I create a new instance of A associated with both b and c. I've got the ids for b and c.
You can create a new instance of a like this:
A.create :b => b, :c => c