method
load
v2.0.3 -
Show latest stable
-
0 notes -
Class: ActiveResource::Base
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3 (0)
- 2.1.0 (0)
- 2.2.1 (4)
- 2.3.8 (0)
- 3.0.0 (0)
- 3.0.9 (-2)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 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?
load(attributes)
public
A method to manually load attributes from a hash. Recursively loads collections of resources. This method is called in initialize and create when a Hash of attributes is provided.
Examples
my_attrs = {:name => 'J&J Textiles', :industry => 'Cloth and textiles'} the_supplier = Supplier.find(:first) the_supplier.name # => 'J&M Textiles' the_supplier.load(my_attrs) the_supplier.name('J&J Textiles') # These two calls are the same as Supplier.new(my_attrs) my_supplier = Supplier.new my_supplier.load(my_attrs) # These three calls are the same as Supplier.create(my_attrs) your_supplier = Supplier.new your_supplier.load(my_attrs) your_supplier.save