Hi!
I'm struggling with this for a while and i'm new to rails so it's
quite frustrating ;)
I need to create new model object based on old one with only few
changes.
I have desings -> has many -> lines -> has_many -> fields
I've got input from user in array like this:
field =>[
line_id =>[ fiel_id => field_value]
]
so I iterate:
input[:field].each do |line_id, line|
line.each do |field_id, field_value|
design.lines.find(line_id).fields.find(field_id).value =
field_value
design.lines.find(line_id).fields.find(field_id).something =
field_value
end
end
and when i debug(design) there is no change. I assume it's becouse
find gets data from database again and again.
Is there any solution for my problem?
Adrian
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---