no SQL inserts -- is the controller the problem?

The "save changes" button from http://localhost:3000/feeds/show/1 is supposed to insert data to the memberships table. A check mark is placed next to a "tag" which is unassociated with that feed, then button is clicked.

there are three tables: feeds, tags and a join table of memberships. (I commented out the validations.)

line 96 looks to be the "meat" of the method for the controller, where I suspect the problem lies:

thufir@arrakis ~/strawr $ cat app/controllers/feeds_controller.rb -n | head -n 104 | tail -n 23     82 def add_some_tags     83 logger.info "*******************************add_some_tags*******************************"     84     85 @feed = Feed.find(params[:id])     86     87 logger.info "@feed: #{@feed}"     88     89 @unused_tags =     90 Tag.find(:all) - @feed.tags     91     92 if @unused_tags.any?     93 @tags_to_add = @unused_tags.select { |tag|     94 (params['tag'+tag.id.to_s]['checked'] == '1')}     95 @tags_to_add.each { |tag|     96 @feed.tags << Tag.find_or_create_by_tag(params [:which_tag]) unless params[:which_tag].blank?     97 }     98 end     99    100 if @tags_to_add.any? and @feed.save    101 flash[:notice] = 'Tags have been added!'    102 end    103 redirect_to :action => 'show', :id => @feed    104 end thufir@arrakis ~/strawr $

I suspect that the above method does nothing because the log shows no SQL inserts. The "add_some_tags" is strictly querying the db (particularly I'm looking at line 54, where I'd also like to see, I believe, an insert):

thufir@arrakis ~/strawr $ cat log/development.log -n | head -n 59 | tail - n 27     33
*******************************add_some_tags*******************************     34 Feed Columns (0.001474) SHOW FIELDS FROM feeds     35 Feed Load (0.000666) SELECT * FROM feeds WHERE (feeds.`id` = 1)     36 @feed: #<Feed:0xb6fc6a50>     37 Tag Load (0.000594) SELECT * FROM tags     38 Tag Load (0.000747) SELECT tags.* FROM tags INNER JOIN memberships ON tags.id = memberships.tag_id WHERE ((memberships.feed_id = 1))     39 Tag Columns (0.001404) SHOW FIELDS FROM tags     40 SQL (0.000230) BEGIN     41 Feed Update (0.000583) UPDATE feeds SET `feed` = 'feed one' WHERE `id` = 1     42 SQL (0.000342) COMMIT     43 Redirected to http://localhost:3000/feeds/show/1     44 Completed in 0.18848 (5 reqs/sec) | DB: 0.00604 (3%) | 302 Found [http://localhost/feeds/add_some_tags/1\]     45     46     47 Processing FeedsController#show (for 127.0.0.1 at 2008-01-24 07:18:01) [GET]     48 Session ID: 98ae0df6837d8c491cfd58ecfee7c744     49 Parameters: {"action"=>"show", "id"=>"1", "controller"=>"feeds"}     50 Feed Columns (0.001463) SHOW FIELDS FROM feeds     51 Feed Load (0.000606) SELECT * FROM feeds WHERE (feeds.`id` = 1)     52 Rendering within layouts/feeds     53 Rendering feeds/show     54 Tag Load (0.000757) SELECT tags.* FROM tags INNER JOIN memberships ON tags.id = memberships.tag_id WHERE ((memberships.feed_id = 1))     55 Tag Columns (0.001395) SHOW FIELDS FROM tags     56 DEPRECATION WARNING: Passing :post as a link modifier is deprecated. Use :method => "post" instead. :post will be removed in Rails 2.0. See http://www.rubyonrails.org/deprecation for details. (called from convert_options_to_javascript! at /usr/lib/ruby/gems/1.8/gems/ actionpack-1.13.5/lib/action_view/helpers/url_helper.rb:331)     57 DEPRECATION WARNING: Passing :post as a link modifier is deprecated. Use :method => "post" instead. :post will be removed in Rails 2.0. See http://www.rubyonrails.org/deprecation for details. (called from convert_options_to_javascript! at /usr/lib/ruby/gems/1.8/gems/ actionpack-1.13.5/lib/action_view/helpers/url_helper.rb:331)     58 Tag Load (0.000581) SELECT * FROM tags     59 Completed in 0.06378 (15 reqs/sec) | Rendering: 0.04030 (63%) | DB: 0.00480 (7%) | 200 OK [http://localhost/feeds/show/1\] thufir@arrakis ~/strawr $

thanks,

Thufir

http://code.google.com/p/strawr/source

The "save changes" button from http://localhost:3000/feeds/show/1 is supposed to insert data to the memberships table. A check mark is
placed next to a "tag" which is unassociated with that feed, then button is clicked.

there are three tables: feeds, tags and a join table of
memberships. (I commented out the validations.)

line 96 looks to be the "meat" of the method for the controller,
where I suspect the problem lies:

Install ruby-debug (gem install ruby-debug) run rdebug script/server

stick a call to 'debugger' where you think might be relevant Step though the code.

Fred