aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/lib/active_record/serializers/json_serializer.rb9
-rw-r--r--activeresource/lib/active_resource/base.rb8
2 files changed, 11 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/serializers/json_serializer.rb b/activerecord/lib/active_record/serializers/json_serializer.rb
index e9cb8bfca9..48df15d2c0 100644
--- a/activerecord/lib/active_record/serializers/json_serializer.rb
+++ b/activerecord/lib/active_record/serializers/json_serializer.rb
@@ -82,14 +82,17 @@ module ActiveRecord #:nodoc:
end
end
- # For compatibility with ActiveSupport::JSON.encode
- alias rails_to_json to_json
-
def from_json(json)
self.attributes = ActiveSupport::JSON.decode(json)
self
end
+ private
+ # For compatibility with ActiveSupport::JSON.encode
+ def rails_to_json(options, *args)
+ to_json(options)
+ end
+
class JsonSerializer < ActiveRecord::Serialization::Serializer #:nodoc:
def serialize
ActiveSupport::JSON.encode(serializable_record)
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index 2e742267ba..f9a461d02e 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -890,9 +890,6 @@ module ActiveResource
ActiveSupport::JSON.encode(attributes, options)
end
- # For compatibility with ActiveSupport::JSON.encode
- alias rails_to_json to_json
-
# Returns the serialized string representation of the resource in the configured
# serialization format specified in ActiveResource::Base.format. The options
# applicable depend on the configured encoding format.
@@ -1064,6 +1061,11 @@ module ActiveResource
self.class.__send__(:split_options, options)
end
+ # For compatibility with ActiveSupport::JSON.encode
+ def rails_to_json(options, *args)
+ to_json(options)
+ end
+
def method_missing(method_symbol, *arguments) #:nodoc:
method_name = method_symbol.to_s