We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 31aec23 + f9e7376 commit 3f838c9Copy full SHA for 3f838c9
activemodel/lib/active_model/validations.rb
@@ -437,20 +437,6 @@ def validate!(context = nil)
437
alias :read_attribute_for_validation :send
438
439
# Returns the context when running validations.
440
- #
441
- # This is useful when running validations except a certain context (opposite to the +on+ option).
442
443
- # class Person
444
- # include ActiveModel::Validations
445
446
- # attr_accessor :name
447
- # validates :name, presence: true, if: -> { validation_context != :custom }
448
- # end
449
450
- # person = Person.new
451
- # person.valid? #=> false
452
- # person.valid?(:new) #=> false
453
- # person.valid?(:custom) #=> true
454
def validation_context
455
context_for_validation.context
456
end
0 commit comments