lib/active_remote/errors.rb in active_remote-2.1.1 vs lib/active_remote/errors.rb in active_remote-2.2.0

- old
+ new

@@ -7,9 +7,20 @@ # Raised by ActiveRemove::Base.save when the remote record is readonly. class ReadOnlyRemoteRecord < ActiveRemoteError end + # Raised by ActiveRemote::Validations when save is called on an invalid record. + class RemoteRecordInvalid < ActiveRemoteError + attr_reader :record + + def initialize(record) + @record = record + errors = @record.errors.full_messages.join(', ') + super(errors) + end + end + # Raised by ActiveRemove::Base.find when remote record is not found when # searching with the given arguments. class RemoteRecordNotFound < ActiveRemoteError attr_accessor :remote_record_class