diff options
author | José Valim <jose.valim@gmail.com> | 2011-11-25 09:58:18 +0000 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-11-25 09:59:35 +0000 |
commit | fcacc6986ab60f1fb2e423a73bf47c7abd7b191d (patch) | |
tree | b4176f645915ac80d2ba43b54aa836d3bc4f7d21 /activerecord | |
parent | 4565c871a63dddcb9543eb5be315f152ac551c17 (diff) | |
parent | 696d01f7f4a8ed787924a41cce6df836cd73c46f (diff) | |
download | rails-fcacc6986ab60f1fb2e423a73bf47c7abd7b191d.tar.gz rails-fcacc6986ab60f1fb2e423a73bf47c7abd7b191d.tar.bz2 rails-fcacc6986ab60f1fb2e423a73bf47c7abd7b191d.zip |
Merge branch 'serializers'
This implements the ActiveModel::Serializer object. Includes code, tests, generators and guides.
From José and Yehuda with love.
Conflicts:
railties/CHANGELOG.md
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/serialization.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/serializers/xml_serializer.rb | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/serialization.rb b/activerecord/lib/active_record/serialization.rb index 5ad40d8cd9..c23514c465 100644 --- a/activerecord/lib/active_record/serialization.rb +++ b/activerecord/lib/active_record/serialization.rb @@ -2,7 +2,7 @@ module ActiveRecord #:nodoc: # = Active Record Serialization module Serialization extend ActiveSupport::Concern - include ActiveModel::Serializers::JSON + include ActiveModel::Serializable::JSON def serializable_hash(options = nil) options = options.try(:clone) || {} diff --git a/activerecord/lib/active_record/serializers/xml_serializer.rb b/activerecord/lib/active_record/serializers/xml_serializer.rb index 0e7f57aa43..2da836ef0c 100644 --- a/activerecord/lib/active_record/serializers/xml_serializer.rb +++ b/activerecord/lib/active_record/serializers/xml_serializer.rb @@ -3,7 +3,7 @@ require 'active_support/core_ext/hash/conversions' module ActiveRecord #:nodoc: module Serialization - include ActiveModel::Serializers::Xml + include ActiveModel::Serializable::XML # Builds an XML document to represent the model. Some configuration is # available through +options+. However more complicated cases should @@ -176,13 +176,13 @@ module ActiveRecord #:nodoc: end end - class XmlSerializer < ActiveModel::Serializers::Xml::Serializer #:nodoc: + class XmlSerializer < ActiveModel::Serializable::XML::Serializer #:nodoc: def initialize(*args) super options[:except] = Array.wrap(options[:except]) | Array.wrap(@serializable.class.inheritance_column) end - class Attribute < ActiveModel::Serializers::Xml::Serializer::Attribute #:nodoc: + class Attribute < ActiveModel::Serializable::XML::Serializer::Attribute #:nodoc: def compute_type klass = @serializable.class type = if klass.serialized_attributes.key?(name) |