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
- #from_xml(xml) ⇒ Object
-
#to_xml(options = {}, &block) ⇒ Object
Returns XML representing the model.
Methods included from ActiveModel::Serialization
Instance Method Details
#from_xml(xml) ⇒ Object
142 143 144 145 |
# File 'lib/active_model/serializers/xml.rb', line 142 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
.
138 139 140 |
# File 'lib/active_model/serializers/xml.rb', line 138 def to_xml( = {}, &block) Serializer.new(self, ).serialize(&block) end |