use ActiveSupport::JSON.encode instead of the to_json method (not reliable)
This commit is contained in:
parent
8956145da7
commit
2c562038d8
@ -46,7 +46,7 @@ module Admin::BaseHelper
|
||||
def collection_to_js(collection, options = {})
|
||||
js = collection.collect { |object| object.to_json }
|
||||
|
||||
options_to_js = options.to_json.gsub(/^\{/, '').gsub(/\}$/, '')
|
||||
options_to_js = ActiveSupport::JSON.encode(options).gsub(/^\{/, '').gsub(/\}$/, '')
|
||||
|
||||
"new Object({ \"collection\": [#{js.join(', ')}], #{options_to_js} })"
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user