method
    
    from_xml
  
      v4.2.7 - 
      Show latest stable
 - 
    0 notes - 
    Class: ActiveModel::Serializers::Xml
    
  
  
- 1.0.0
 - 1.1.6
 - 1.2.6
 - 2.0.3
 - 2.1.0
 - 2.2.1
 - 2.3.8
 - 3.0.0 (0)
 - 3.0.9 (0)
 - 3.1.0 (0)
 - 3.2.1 (0)
 - 3.2.8 (0)
 - 3.2.13 (0)
 - 4.0.2 (38)
 - 4.1.8 (0)
 - 4.2.1 (0)
 - 4.2.7 (0)
 - 4.2.9 (0)
 - 5.0.0.1
 - 5.1.7
 - 5.2.3
 - 6.0.0
 - 6.1.3.1
 - 6.1.7.7
 - 7.0.0
 - 7.1.3.2
 - 7.1.3.4
 - What's this?
 
from_xml(xml)
  public
  Sets the model attributes from an XML string. Returns self.
class Person include ActiveModel::Serializers::Xml attr_accessor :name, :age, :awesome def attributes=(hash) hash.each do |key, value| instance_variable_set("@#{key}", value) end end def attributes instance_values end end xml = { name: 'bob', age: 22, awesome:true }.to_xml person = Person.new person.from_xml(xml) # => #<Person:0x007fec5e3b3c40 @age=22, @awesome=true, @name="bob"> person.name # => "bob" person.age # => 22 person.awesome # => true

  