lib/active_remote/errors.rb in active_remote-5.1.0 vs lib/active_remote/errors.rb in active_remote-5.1.1

- old
+ new

@@ -41,9 +41,19 @@ end # Raised by ActiveRemove::Base.save! and ActiveRemote::Base.create! methods # when remote record cannot be saved because it is invalid. class RemoteRecordNotSaved < ActiveRemoteError + attr_reader :record + + def initialize(message_or_record = nil) + message = message_or_record + if message_or_record.is_a?(::ActiveRemote::Base) + @record = message_or_record + message = @record.errors.full_messages.join(", ") + end + super(message) + end end class UnknownAttributeError < ActiveRemoteError end