diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2014-07-05 15:29:15 -0700 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2014-07-05 15:29:15 -0700 |
commit | 6f3c64eeb1dc8288dae49f114aaf619adc7dcb7f (patch) | |
tree | 57d11c3bab0f301739c21c7c3cd8c94a266cdc1d /activerecord/lib | |
parent | a03097759bd7103bb9db253e7ba095f011453f75 (diff) | |
download | rails-6f3c64eeb1dc8288dae49f114aaf619adc7dcb7f.tar.gz rails-6f3c64eeb1dc8288dae49f114aaf619adc7dcb7f.tar.bz2 rails-6f3c64eeb1dc8288dae49f114aaf619adc7dcb7f.zip |
Revert "Merge pull request #16059 from jenncoop/json-serialized-attr"
This reverts commit a03097759bd7103bb9db253e7ba095f011453f75.
This needs more work before it would work correctly on master.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record.rb | 1 | ||||
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/serialization.rb | 7 | ||||
-rw-r--r-- | activerecord/lib/active_record/coders/json.rb | 13 |
3 files changed, 1 insertions, 20 deletions
diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb index 9028970a3d..17b00bbaea 100644 --- a/activerecord/lib/active_record.rb +++ b/activerecord/lib/active_record.rb @@ -97,7 +97,6 @@ module ActiveRecord module Coders autoload :YAMLColumn, 'active_record/coders/yaml_column' - autoload :JSON, 'active_record/coders/json' end module AttributeMethods diff --git a/activerecord/lib/active_record/attribute_methods/serialization.rb b/activerecord/lib/active_record/attribute_methods/serialization.rb index 264ce2bdfa..734d94865a 100644 --- a/activerecord/lib/active_record/attribute_methods/serialization.rb +++ b/activerecord/lib/active_record/attribute_methods/serialization.rb @@ -37,12 +37,7 @@ module ActiveRecord # serialize :preferences, Hash # end def serialize(attr_name, class_name_or_coder = Object) - # When ::JSON is used, force it to go through the Active Support JSON encoder - # to ensure special objects (e.g. Active Record models) are dumped correctly - # using the #as_json hook. - coder = if class_name_or_coder == ::JSON - Coders::JSON - elsif [:load, :dump].all? { |x| class_name_or_coder.respond_to?(x) } + coder = if [:load, :dump].all? { |x| class_name_or_coder.respond_to?(x) } class_name_or_coder else Coders::YAMLColumn.new(class_name_or_coder) diff --git a/activerecord/lib/active_record/coders/json.rb b/activerecord/lib/active_record/coders/json.rb deleted file mode 100644 index 0f60b6dab2..0000000000 --- a/activerecord/lib/active_record/coders/json.rb +++ /dev/null @@ -1,13 +0,0 @@ -module ActiveRecord - module Coders # :nodoc: - class JSON # :nodoc: - def self.dump(obj) - ActiveSupport::JSON.encode(obj) - end - - def self.load(json) - ActiveSupport::JSON.decode(json) - end - end - end -end |