I have a form that has a nested form like this:
<%- for subscription in @task.subscriptions -%>
<%- semantic_fields_for "task[subscription_attributes][]", subscription do |subscription_form|%>
<%- subscription_form.inputs do -%>
<%= subscription_form.input :workhours, :label => subscription.user.full_name%>
<%- end -%>
<%- end -%>
<%- end -%>
And on the task model I have:
accepts_nested_attributes_for :subscriptions
attr_accessible :mission_id, :statuscode_id, :name, :objectives, :start_at , :end_at, :hours, :testimony ,:subscriptions_attributes
In the form (view) I get the correct values on the workhours fields. But when I change the values and hit the submit button, the values are never changed. I can't figure out why...
I see in the console that this is building up on the tasks attributes. So the values are passing to the controller.
"subscription_attributes"=>{"11"=>{"workhours"=>"20"}, "12"=>{"workhours"=>"303"}, "9"=>{"workhours"=>"120"}, "10"=>{"workhours"=>"10"}}
On the tasks_controller I have:
@task.update_attributes(params[:task])