You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
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еуеуыуеыуфпфукпукп</p>\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?
The text was updated successfully, but these errors were encountered:
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еуеуыуеыуфпфукпукп</p>\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?
The text was updated successfully, but these errors were encountered: