Module: ActiveModel::Serializers::Xml

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::Serialization
Defined in:
lib/active_model/serializers/xml.rb

Defined Under Namespace

Classes: Serializer

Instance Method Summary collapse

Methods included from ActiveModel::Serialization

#serializable_hash

Instance Method Details

#from_xml(xml) ⇒ Object



141
142
143
144
# File 'lib/active_model/serializers/xml.rb', line 141

def from_xml(xml)
  self.attributes = Hash.from_xml(xml).values.first
  self
end

#to_xml(options = {}, &block) ⇒ Object

Returns XML representing the model. Configuration can be passed through options.



137
138
139
# File 'lib/active_model/serializers/xml.rb', line 137

def to_xml(options = {}, &block)
  Serializer.new(self, options).serialize(&block)
end