Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Mixing new elements on submit #133

Closed
kinley opened this Issue · 2 comments

2 participants

@kinley

I'm using nested_model in my form. Everything is ok: it's adding and removing elements, but when I click submit button, it mix the order of new added elements.
For example, I have
class Unit < ActiveRecord::Base
has_many :vocabulizers
accepts_nested_attributes_for :vocabulizers, :reject_if => lambda { |a| a[:word].blank? }, :allow_destroy => true
end

and I want to add Vocabulizer elements with word attributes 1,2 and 3
as a result I get:
Parameters: {"commit"=>"Сохранить и выйти", "authenticity_token"=>"v9tmU4HWiTO7PxNLV1frP9icY5A5eC1zZ7X2KkyMC/Y=", "utf8"=>"✓", "id"=>"64", "unit"=>{"price"=>"15", "title"=>"teste", "learning_module_id"=>"1",
"vocabulizers_attributes"=>
{"new_1326353468552"=>{"usage"=>"", "word"=>"3", "translation"=>"", "_destroy"=>"false", "usage_t"=>""},
"0"=>{"usage"=>"", "word"=>"2", "id"=>"1152", "translation"=>"", "_destroy"=>"1", "usage_t"=>""},
"new_1326353464160"=>{"usage"=>"", "word"=>"1", "translation"=>"", "_destroy"=>"false", "usage_t"=>""},
"1"=>{"usage"=>"", "word"=>"3", "id"=>"1153", "translation"=>"", "_destroy"=>"1", "usage_t"=>""},
"2"=>{"usage"=>"", "word"=>"1", "id"=>"1154", "translation"=>"", "_destroy"=>"1", "usage_t"=>""},
"new_1326353466528"=>{"usage"=>"", "word"=>"2", "translation"=>"", "_destroy"=>"false", "usage_t"=>""}}, "theory"=>"

\r\n\tеуеуыуеыуфпфукпукп\

\r\n

\r\n\tteset one more time

\r\n", "description"=>""}}

as you see, vocabulizer_attributes are mixed. why is it happens? And why it makes 6 elements instead of 3?

@lest
Collaborator

Is there still an issue? Could you please push a test application reproducing this issue?

@lest
Collaborator

Closing as it looks like a duplication of #37.

@lest lest closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.