saving nested attributes

Posted by Victor Martins on Stack Overflow See other posts from Stack Overflow or by Victor Martins
Published on 2010-04-02T18:19:06Z Indexed on 2010/04/02 18:23 UTC
Read the original article Hit count: 228

Filed under:
|

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...

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about formtastic