class ActiveModel::Serializers::Xml::Serializer
def attributes_hash
level model can have both :except and :only set. So if
then because :except is set to a default value, the second
for a N level model but is set for the N+1 level models,
takes precedence over :only. If :only is not set
To replicate the behavior in ActiveRecord#attributes, :except
def attributes_hash attributes = @serializable.attributes if options[:only].any? attributes.slice(*options[:only]) elsif options[:except].any? attributes.except(*options[:except]) else attributes end end