Class: Mongoa::MongoMapper::Matchers::ValidatePresenceOfMatcher

Inherits:
ValidateBase
  • Object
show all
Defined in:
lib/mongoa/mongo_mapper/validations/validate_presence_of.rb

Instance Attribute Summary

Attributes inherited from ValidateBase

#attribute

Instance Method Summary collapse

Methods inherited from ValidateBase

#initialize, #matches?

Constructor Details

This class inherits a constructor from Mongoa::MongoMapper::Matchers::ValidateBase

Instance Method Details

#descriptionObject



5
6
7
# File 'lib/mongoa/mongo_mapper/validations/validate_presence_of.rb', line 5

def description
  "require #{@attribute} to be set"
end

#failure_messageObject



9
10
11
# File 'lib/mongoa/mongo_mapper/validations/validate_presence_of.rb', line 9

def failure_message
  "Expected #{@attribute} to be a required field (validates_presence_of or :required => true) but was not"
end

#negative_failure_messageObject



13
14
15
# File 'lib/mongoa/mongo_mapper/validations/validate_presence_of.rb', line 13

def negative_failure_message
  "Expected #{@attribute} to not be a required field (validates_presence_of or :required => true), but it was"
end