Exception: Shoulda::Matchers::ActiveRecord::ValidateUniquenessOfMatcher::ExistingRecordInvalid

Inherits:
Error
  • Object
show all
Includes:
Shoulda::Matchers::ActiveModel::Helpers
Defined in:
lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Shoulda::Matchers::ActiveModel::Helpers

#default_error_message, #format_validation_errors, #pretty_error_messages

Methods inherited from Error

create, #initialize, #inspect

Constructor Details

This class inherits a constructor from Shoulda::Matchers::Error

Instance Attribute Details

#underlying_exceptionObject

Returns the value of attribute underlying_exception.



1187
1188
1189
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1187

def underlying_exception
  @underlying_exception
end

Instance Method Details

#messageObject



1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1189

def message
  "validate_uniqueness_of works by matching a new record against an\nexisting record. If there is no existing record, it will create one\nusing the record you provide.\n\nWhile doing this, the following error was raised:\n\n\#{Shoulda::Matchers::Util.indent(underlying_exception.message, 2)}\n\nThe best way to fix this is to provide the matcher with a record where\nany required attributes are filled in with valid values beforehand.\n  MESSAGE\nend\n".strip