Displaying 1 result from an estimated 1 matches for "articles_contributors".
2006 Feb 23
2
Saving a collection field with <<
I have habtm relationship between articles and contributors.
Everything''s working fine, except when I create a new article Rails
doesn''t seem to save the contributors that belong to it into
articles_contributors. This is the controller (that I pilfered from
typo):
def new
@article = Article.new(params[:article])
[...]
if request.post?
@article.contributors.clear
@article.contributors << Contributor.find(params[:contributors])
if params[:contributors]
if @article.save...