Hello,
ActiveSupport::JSON::Variable.to_json is the only to_json without an "options" parameter. Is this intended?
For example, this code in a .rjs
page[@user.dom_id].visual_effect :drop_out, :afterFinish => ActiveSupport::JSON::Variable.new("foo")
fails with
ActionView::TemplateError: wrong number of arguments (1 for 0) On line #7 of app/views/admin/users/enable.rjs
7: page[@user.dom_id].visual_effect :drop_out, :afterFinish => ActiveSupport::JSON::Variable.new("foo") vendor/rails/activesupport/lib/active_support/json/encoding.rb:22:in `to_json' vendor/rails/activesupport/lib/active_support/json/encoding.rb:22:in `send' vendor/rails/activesupport/lib/active_support/json/encoding.rb:22:in `encode' vendor/rails/activesupport/lib/active_support/json/encoding.rb:32:in `raise_on_circular_reference' vendor/rails/activesupport/lib/active_support/json/encoding.rb:21:in `encode' vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:13:in `to_json' vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:12:in `map' vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:12:in `to_json' vendor/rails/activesupport/lib/active_support/core_ext/object/misc.rb:28:in `returning' vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:11:in `to_json' vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb:698:in `javascript_object_for' vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb:703:in `arguments_for_call' vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb:703:in `map' vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb:703:in `arguments_for_call' vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb:813:in `send' vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb:813:in `call' vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb:808:in `method_missing' ...
Adding the options parameter no longer fails.
def to_json(options = nil) self end
Cheers, Pascal.