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
When I drop one option left and one right, save them and refresh the page, the options get saved correctly.
# left
params sent
{"snippet_0"=>{"name"=>"template_test", "options"=>{"name"=>"0"}}}
# mercury_content (persisted)
{"snippet_0"=>{"name"=>"template_test", "options"=>{"name"=>"0"}}}
# after updating snippets
{"snippet_0"=>{"name"=>"template_test", "options"=>{"name"=>"0"}}}
# right
# params sent
{"snippet_1"=>{"name"=>"template_test", "options"=>{"name"=>"1"}}}
# mercury_content (persisted)
{"snippet_1"=>{"name"=>"template_test", "options"=>{"name"=>"1"}}}
# after updating snippets
{"snippet_1"=>{"name"=>"template_test", "options"=>{"name"=>"1"}}}
Now I add one snippet-options to the right, save them again, they submitted parameters are in a completly shuffled order:
# left
# param
{"snippet_0"=>{"name"=>"template_test", "options"=>{"name"=>"3"}}}
# mercury
{"snippet_0"=>{"name"=>"template_test", "options"=>{"name"=>"1"}}}
# after snippets update
{"snippet_0"=>{"name"=>"template_test", "options"=>{"name"=>"3"}}}
# right
# param
{"snippet_1"=>{"name"=>"template_test", "options"=>{"name"=>"3"}}}
# mercury
{"snippet_2"=>{"name"=>"template_test", "options"=>{"name"=>"3"}},
"snippet_1"=>{"name"=>"template_test", "options"=>{"name"=>"2"}}}
# after snippets update
{"snippet_1"=>{"name"=>"template_test", "options"=>{"name"=>"3"}}}
When I refresh the page again, they pop over to the other snippet area.
I save the options of snippets within a serialized single database entry.
defupdateifparams[:mercury][:content]params[:mercury][:content].eachdo |request_item|
returnifrequest_item.is_a?Hashrequest_data=request_item[1]request_id=request_item[0]c=MercuryContent.where(name: request_id,type: request_data['type']).first_or_create!request_data[:settings]=request_data.delete('request_data')# extract snippetssnippets_only=request_data.delete('snippets')c.update_attributes(request_data)# I keep the snippets when submitted snippets are empty (mercury seems to be not sending optionsc.update_attribute(:snippets,snippets_only)ifsnippets_only && !snippets_only.empty?endendrendertext: ""# return for mercuryend
Thank you in advance!!!! (urgent)
---
There is a **[$15 open bounty](https://www.bountysource.com/issues/26746701-snippet-options-not-saved-correctly?utm_campaign=plugin&utm_content=tracker%2F134071&utm_medium=issues&utm_source=github)** on this issue. Add to the bounty at [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F134071&utm_medium=issues&utm_source=github).
The text was updated successfully, but these errors were encountered:
jejacks0n
changed the title
Snippet options not saved correctly
Snippet options not saved correctly [$15]
Sep 17, 2015
Before you read on:
*Should I save the snippet options
in a seperate DB Table?*
Or can I serialize this in the same db entry as the content (column named snippets and is serialzed)
Please help me out !!!
I have two
snippet
-areas on my page with unique ids:When I drop one option left and one right, save them and refresh the page, the options get saved correctly.
Now I add one snippet-options to the right, save them again, they submitted parameters are in a completly shuffled order:
When I refresh the page again, they pop over to the other snippet area.
I save the options of snippets within a serialized single database entry.
Thank you in advance!!!! (urgent)
--- There is a **[$15 open bounty](https://www.bountysource.com/issues/26746701-snippet-options-not-saved-correctly?utm_campaign=plugin&utm_content=tracker%2F134071&utm_medium=issues&utm_source=github)** on this issue. Add to the bounty at [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F134071&utm_medium=issues&utm_source=github).The text was updated successfully, but these errors were encountered: