diff options
author | José Valim <jose.valim@gmail.com> | 2011-09-30 12:45:36 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-09-30 12:45:36 +0200 |
commit | 37b9594a8e08916e1e9ae9a6aaffc13ef516ad11 (patch) | |
tree | f62709f7669d7fe783eb13f7045cf88cd8dd64f5 /activesupport/lib/active_support/json | |
parent | afeb8976a34a3e3b4568357e08ea564d15d72d2f (diff) | |
download | rails-37b9594a8e08916e1e9ae9a6aaffc13ef516ad11.tar.gz rails-37b9594a8e08916e1e9ae9a6aaffc13ef516ad11.tar.bz2 rails-37b9594a8e08916e1e9ae9a6aaffc13ef516ad11.zip |
Set the default options value for as_json in the encoder object.
Diffstat (limited to 'activesupport/lib/active_support/json')
-rw-r--r-- | activesupport/lib/active_support/json/encoding.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb index 67698c1cff..469ae69258 100644 --- a/activesupport/lib/active_support/json/encoding.rb +++ b/activesupport/lib/active_support/json/encoding.rb @@ -38,7 +38,7 @@ module ActiveSupport attr_reader :options def initialize(options = nil) - @options = options + @options = options || {} @seen = Set.new end @@ -59,7 +59,7 @@ module ActiveSupport def options_for(value) if value.is_a?(Array) || value.is_a?(Hash) # hashes and arrays need to get encoder in the options, so that they can detect circular references - (options || {}).merge(:encoder => self) + options.merge(:encoder => self) else options end |