I think that the line with “@feed.tags <<
Tag.find_or_create_by_tag(params
[:which_tag]) unless params[:which_tag].blank?” isn’t correctly saving
data.
What I want to happen is that the user places a checkmark on a “tag”,
then clicks the button. That adds a record to the “memberships” table
with three fields:
tag_id
thufir@arrakis ~/strawr $
“add_some_tags”
Tag.find(:all) - @feed.tags
if @tags_to_add.any? and @feed.save
flash[:notice] = ‘Tags have been added!’
end
redirect_to :action => ‘show’, :id => @feed
end
end
Poking around in the code, I notice a few things.
feed has many tags through memberships, and membership.rb has some
validations, perhaps these are failing.
In your controller code, in the method above you are using
push_with_attributes, which is deprecated, you seem to be mixing hmt
with the obsolete push_with_attributes.
feed has many tags through memberships, and membership.rb has some
validations, perhaps these are failing.
Yes, I was considering this and dropping the validations; I’ll do
that.
In your controller code, in the method above you are using
push_with_attributes, which is deprecated, you seem to be mixing hmt
with the obsolete push_with_attributes.
I want to fix this regardless. I found:
"push_with_attributes and concat_with_attributes on a HABTM
association
are deprecated. Use has_many :through with a join model instead. "