The params sent to the controller are not nesting correctly as seen below.

<% fields_for "discount_code[new_discount][]
", task do |form| %>
        Tour Type ID: <%= form.text_field :tour_type_id %>
        Price: <%= form.text_field :price_number %>
        Days: <%= form.text_field :days %>
<% end %>

I would expect this to come into the controller looking like

parameters : {"discount_code" => 
     {"new_discount" =>  [
                {"tour_type_id" => '8', "price_number" => '8.00', "days" => 
'-1'},
                {"tour_type_id" => '7', "price_number" => '22.00', "days" => 
'3'}
      ]
}

Instead - it's coming in like this:

Parameters : {:discount_code => 
   {"new_discount_attributes" =>[ 
   {"tour_type_id"=>"7"}, 
    {"day"=>"-1", "tour_type_id"=>"8"}, 
    {"day"=>"3", "price_number"=>"22.00"}, 
    {"price_number"=>"8.00"}],

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to