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:
feed_id tag_id membership_id
However, the db remains unchanged
An excerpt from http://strawr.googlecode.com/svn/trunk/app/controllers/feeds_controller.rb with the relevant method:
thufir@arrakis ~/strawr $ thufir@arrakis ~/strawr $ tail app/controllers/feeds_controller.rb -n 34
def add_some_tags
logger.info "*******************************add_some_tags*******************************" logger.info "*******************************add_some_tags*******************************" logger.info "*******************************add_some_tags*******************************" #logger.info "foo: #{@my_var}" #logger.info "my text" #@my_var = "something"
@feed = Feed.find(params[:id])
logger.info "@feed: #{@feed}"
@unused_tags = Tag.find(:all) - @feed.tags
if @unused_tags.any? @tags_to_add = @unused_tags.select { |tag| (params['tag'+tag.id.to_s]['checked'] == '1')} @tags_to_add.each { |tag| @feed.tags << Tag.find_or_create_by_tag(params[:which_tag]) unless params[:which_tag].blank? } end
if @tags_to_add.any? and @feed.save flash[:notice] = 'Tags have been added!' end redirect_to :action => 'show', :id => @feed end
end thufir@arrakis ~/strawr $
thanks,
Thufir