Module: ActiveRemote::Serialization::ClassMethods
- Defined in:
- lib/active_remote/serialization.rb
Instance Method Summary collapse
- 
  
    
      #serialize_records(records)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Serialize the given records into Active Remote objects. 
Instance Method Details
#serialize_records(records) ⇒ Object
Serialize the given records into Active Remote objects.
Examples
records = [ Generic::Remote::TagRequest.new(:name => 'foo') ]
Tag.serialize_records(records) # => [ Tag#{:name => 'foo'} ]
| 18 19 20 21 22 23 24 | # File 'lib/active_remote/serialization.rb', line 18 def serialize_records(records) records.map do |record| model = instantiate(record.to_hash) model.add_errors(record.errors) if record.respond_to?(:errors) model end end |