There is a cool feature for has_many
in Rails. I can write
class Article < AR::Base
has_many :comments
has_one :another_association
and voila! method comment_ids=
created, which I can use in strong parameters and mass assignment. Somethind like @article.comment_ids = [1,2,3]
I need something similar for has_one
, like @article.another_association_id = 1
. But I get NoMethodError
exception. Is there any way to make this method works?