aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/coders
diff options
context:
space:
mode:
authorGodfrey Chan <godfreykfc@gmail.com>2014-07-05 14:23:01 -0700
committerGodfrey Chan <godfreykfc@gmail.com>2014-07-05 14:34:13 -0700
commita03097759bd7103bb9db253e7ba095f011453f75 (patch)
tree4a20132e2c7fe66f25e7170ae751d3b67d92b3f5 /activerecord/lib/active_record/coders
parentacec038b38dc248c5c2f350de69ab89d9b1402c7 (diff)
downloadrails-a03097759bd7103bb9db253e7ba095f011453f75.tar.gz
rails-a03097759bd7103bb9db253e7ba095f011453f75.tar.bz2
rails-a03097759bd7103bb9db253e7ba095f011453f75.zip
Merge pull request #16059 from jenncoop/json-serialized-attr
Fixed issue with ActiveRecord serialize object as JSON Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/attribute_methods/serialization.rb
Diffstat (limited to 'activerecord/lib/active_record/coders')
-rw-r--r--activerecord/lib/active_record/coders/json.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/coders/json.rb b/activerecord/lib/active_record/coders/json.rb
new file mode 100644
index 0000000000..0f60b6dab2
--- /dev/null
+++ b/activerecord/lib/active_record/coders/json.rb
@@ -0,0 +1,13 @@
+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