Class: Remarkable::ActiveRecord::Matchers::ValidateUniquenessOfMatcher
- Inherits:
-
Matcher::Base
- Object
- Matcher::Base
- Remarkable::ActiveRecord::Matchers::ValidateUniquenessOfMatcher
- Includes:
- Helpers
- Defined in:
- lib/remarkable/active_record/macros/validations/validate_uniqueness_of_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
- #scope(scope) ⇒ Object
-
#scoped_to(scoped) ⇒ Object
TODO Deprecate this.
Methods included from Helpers
#allow_blank, #allow_nil, #message
Methods included from Default::Helpers
#assert_contains, #assert_does_not_contain
Methods inherited from Matcher::Base
#failure_message, #negative, #negative_failure_message, #spec
Methods included from Matcher::DSL
Instance Method Details
#description ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/remarkable/active_record/macros/validations/validate_uniqueness_of_matcher.rb', line 26 def description = "require unique " if .key? :case_sensitive << ([:case_sensitive] ? 'case sensitive ' : 'case insensitive ') end << "value for #{@attributes.to_sentence}" << " scoped to #{@options[:scope].to_sentence}" unless [:scope].empty? end |
#scope(scope) ⇒ Object
14 15 16 17 |
# File 'lib/remarkable/active_record/macros/validations/validate_uniqueness_of_matcher.rb', line 14 def scope(scope) [:scope] = [*scope].compact self end |
#scoped_to(scoped) ⇒ Object
TODO Deprecate this
21 22 23 24 |
# File 'lib/remarkable/active_record/macros/validations/validate_uniqueness_of_matcher.rb', line 21 def scoped_to(scoped) warn "[DEPRECATION] scoped_to is deprecated. Use only scope instead." scope(scoped) end |