Inserting data using form_for

I was playing around with:
http://strawr.googlecode.com/svn/trunk/app/views/feeds/show.rhtml

and changed a few things so that it’s like so:

thufir@arrakis ~/strawr $
thufir@arrakis ~/strawr $ cat app/views/feeds/show.rhtml -n | head -n 47
| tail -n 10
38
39 <% @unused_tags = Tag.find(:all) - @feed.tags %>
40 <% if @unused_tags.any? %>
41 <% form_for :tag, @tag, :url => { :action => “create” } do |
f| %>
42 <%= f.text_field :tag %>
43 <%= submit_tag ‘Create’ %>
44 <% end %>
45 <% end %>
46
47
thufir@arrakis ~/strawr $

However, what does the above actually do? Here’s output from “script/
server mongrel”:

Processing FeedsController#create (for 127.0.0.1 at 2008-01-24 01:16:37)
[POST]
Session ID: 98ae0df6837d8c491cfd58ecfee7c744
Parameters: {“commit”=>“Create”, “tag”=>{“tag”=>“is this a tag or
feed? should be tag…”}, “action”=>“create”, “controller”=>“feeds”}
Feed Columns (0.012260) SHOW FIELDS FROM feeds
SQL (0.008202) BEGIN
SQL (0.012374) INSERT INTO feeds (feed) VALUES(NULL)
SQL (0.027005) COMMIT
Redirected to http://localhost:3000/feeds/list
Completed in 0.08288 (12 reqs/sec) | DB: 0.05984 (72%) | 302 Found
[http://localhost/feeds/create]

Processing FeedsController#list (for 127.0.0.1 at 2008-01-24 01:16:38)
[GET]
Session ID: 98ae0df6837d8c491cfd58ecfee7c744
Parameters: {“action”=>“list”, “controller”=>“feeds”}
Feed Columns (0.007587) SHOW FIELDS FROM feeds
SQL (0.000587) SELECT count(*) AS count_all FROM feeds
Feed Load (0.000567) SELECT * FROM feeds LIMIT 0, 10
Rendering within layouts/feeds
Rendering feeds/list
Completed in 0.04696 (21 reqs/sec) | Rendering: 0.01785 (38%) | DB:
0.00874 (18%) | 200 OK [http://localhost/feeds/list]
** INT signal received.
Exiting
thufir@arrakis ~/strawr $

where it loks to be inserting a null value into the feeds table, yes?

This is interesting, as it’s close to what I want, which would be
inserting data into tags and also the join table, memberships.

However, it’s inserting data, which is progress :slight_smile:

So, I haven’t commited this to the svn repository (I need to practice
branching for stuff like this), but it’s certainly intriguing.

-Thufir