I have the following two models
class Post < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::Base
belongs_to :post
end
I have an object @post and an array of comments @comments. How can I assign all the comment objects to post in a single line?
should do what you’re asking. Or am I missing something?