Hi
I have a feeds db described like this:
| id | int(11) | NO | PRI | | auto_increment |
| url | varchar(255) | YES | | | |
| name | varchar(255) | YES | | | |
| type | varchar(255) | YES | | | |
| valid | int(11) | YES | | | |
In my feeds view i have :
----
<!--[form:feed]-->
<p><label for="feed_url">URL</label><br/>
<%= text_field ''feed'', ''url''
%></p>
<p><label for="feed_name">Name</label><br/>
<%= text_field ''feed'', ''name''
%></p>
<p><label for="feed_type">Type</label><br/>
<%= select_tag ''feed[type]'', options_for_select( {
"Option1" => "opt1",
"Option2" => "opt" }) %>
<!--[eoform:feed]-->
----
If the data is sent .save and update_attributes doesn''t save the type
field even though it''s sent correctly through the hash (it uses
select_tag):
Parameters: {"feed"=>{"name"=>"name",
"url"=>"http://url.com",
"type"=>"opt1"}, "commit"=>"Edit",
"action"=>"update", "id"=>"5",
"controller"=>"feeds"}
This version however works:
@feed = Feed.find(params[:id])
@feed.type = params[:feed][:type]
if @feed.update_attributes(params[:feed])
[...]
Any ideas on how to fix the select_tag issue ?
Thanks
--
Posted via http://www.ruby-forum.com/.