Module: ActiveModel::Serializers::Xml
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Serialization
- Defined in:
- activemodel/lib/active_model/serializers/xml.rb
Defined Under Namespace
Classes: Serializer
Instance Method Summary (collapse)
- - (Object) from_xml(xml)
-
- (Object) to_xml(options = {}, &block)
Returns XML representing the model.
Methods included from ActiveSupport::Concern
append_features, extended, included
Methods included from ActiveModel::Serialization
Instance Method Details
- (Object) from_xml(xml)
141 142 143 144 |
# File 'activemodel/lib/active_model/serializers/xml.rb', line 141 def from_xml(xml) self.attributes = Hash.from_xml(xml).values.first self end |
- (Object) to_xml(options = {}, &block)
Returns XML representing the model. Configuration can be passed through options.
137 138 139 |
# File 'activemodel/lib/active_model/serializers/xml.rb', line 137 def to_xml( = {}, &block) Serializer.new(self, ).serialize(&block) end |