Module: ActiveLdap::Validations
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/active_ldap/validations.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #save(**options) ⇒ Object
- #save!(**options) ⇒ Object
- #valid?(context = nil) ⇒ Boolean
- #validation_skip_attributes ⇒ Object
- #validation_skip_attributes=(attributes) ⇒ Object
Instance Method Details
#save(**options) ⇒ Object
56 57 58 |
# File 'lib/active_ldap/validations.rb', line 56 def save(**) perform_validations() ? super : false end |
#save!(**options) ⇒ Object
60 61 62 |
# File 'lib/active_ldap/validations.rb', line 60 def save!(**) perform_validations() ? super : raise(EntryInvalid.new(self)) end |
#valid?(context = nil) ⇒ Boolean
50 51 52 53 54 |
# File 'lib/active_ldap/validations.rb', line 50 def valid?(context = nil) context ||= (new_entry? ? :create : :update) output = super(context) errors.empty? && output end |
#validation_skip_attributes ⇒ Object
42 43 44 |
# File 'lib/active_ldap/validations.rb', line 42 def validation_skip_attributes @validation_skip_attributes ||= [] end |
#validation_skip_attributes=(attributes) ⇒ Object
46 47 48 |
# File 'lib/active_ldap/validations.rb', line 46 def validation_skip_attributes=(attributes) @validation_skip_attributes = attributes end |