ruby on rails - Using select_tag with form_for not working -
i have view file contains form_for nested attributes. recently, added select tag update column :tiles form_for object. reason, new column not update on submit, nested attributes work fine.
any idea might doing wrong here?
<%= form_for @user, :html => {:class => "center"} , remote:true |f| %> #does not update tile column in user model. want tiles column save number between 1 10 <%= f.select(:tiles, [*1..10]) %> #updates nested attribute ontology.classification <%= f.fields_for :ontology |ontology| %> <%= ontology.select :classification,options_for_select(tiles::ontology_keys, selected:ontology.object.classification)%> <%end%> <%end%> in user model, using strong parameters
private def user_params params.require(:user).permit(:name, :tiles) end the schema users table follows:
create_table "users", force: true |t| t.string "name" t.string "auth" t.datetime "created_at" t.datetime "updated_at" t.integer "tiles" end adding params hash: parameters:
{"utf8"=>"✓", "user"=>{"tiles"=>"9", "ontology_attributes"=>{"classification"=>"p3", "id"=>"19"}, "things_attributes"=>{"0"=>{"uuid"=>"03f098c4-4feb-4e44-b3ae-8b19b34e837d", "id"=>"58"}, "1"=>{"uuid"=>"92f3a722-4b54-4cf1-8ec9-465831d353b8", "id"=>"59"}, "2"=>{"uuid"=>"5bc5cfef-3dd2-40b1-8113-2abd5ea0570a", "id"=>"60"}}, "data_attributes_attributes"=>{"0"=>{"key"=>"$current_consumption", "id"=>"27"}, "1"=>{"key"=>"$power_consumption_deviation", "id"=>"28"}}}, "button"=>"", "id"=>"42"} thanks helping me out!
Comments
Post a Comment