lib/active_remote/serialization.rb in active_remote-2.3.4 vs lib/active_remote/serialization.rb in active_remote-2.3.5
- old
+ new
@@ -16,10 +16,14 @@
# records = [ Generic::Remote::TagRequest.new(:name => 'foo') ]
#
# Tag.serialize_records(records) # => [ Tag#{:name => 'foo'} ]
#
def serialize_records(records)
- records.map { |record| instantiate(record.to_hash) }
+ records.map do |record|
+ model = instantiate(record.to_hash)
+ model.add_errors(record.errors) if record.respond_to?(:errors)
+ model
+ end
end
end
# Add the given errors to our internal errors list
#