module ActiveModel::Validations::HelperMethods
Methods to be automatically included on every ActiveModel
instance
Public Instance Methods
validate_presence_of_at_least_one_of(*attribute_names)
click to toggle source
Validates whether at least one of the specified attributes is present.
class BillingDetails < ActiveRecord::Base validate_presence_of_at_least_one_of :credit_card, :debit_card end
Configuration options:
-
:message
- Specifies a custom error message (default is: “is not included in the list”).
See ActiveModel::Validations#validates
for more information
# File lib/activemodel/extra_validations/presence_of_at_least_one_of.rb, line 58 def validate_presence_of_at_least_one_of(*attribute_names) validates_with PresenceOfAtLeastOneOfValidator, _merge_attributes(attribute_names) end