creating models with multiple references in rails
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
精彩评论