Permalink
Browse files

Refactor XML serializer to not depend on `serialized_attributes`

  • Loading branch information...
1 parent 29cbfa2 commit 04919c79d71726aac1732b1d1a305051ceee541b Geoff Petrie & Sean Griffin committed with geopet Jun 1, 2014
Showing with 5 additions and 3 deletions.
  1. +5 −3 activerecord/lib/active_record/serializers/xml_serializer.rb
@@ -180,10 +180,12 @@ class XmlSerializer < ActiveModel::Serializers::Xml::Serializer #:nodoc:
class Attribute < ActiveModel::Serializers::Xml::Serializer::Attribute #:nodoc:
def compute_type
klass = @serializable.class
- type = if klass.serialized_attributes.key?(name)
+ column = klass.columns_hash[name] || Type::Value.new
+
+ type = if column.serialized?
super
- elsif klass.columns_hash.key?(name)
- klass.columns_hash[name].type
+ else
+ column.type
end
{ :text => :string,

0 comments on commit 04919c7

Please sign in to comment.