Module: ActiveLdap::Validations
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/active_ldap/validations.rb
Instance Method Summary collapse
- #save ⇒ Object
- #save! ⇒ Object
- #valid?(context = nil) ⇒ Boolean
- #validation_skip_attributes ⇒ Object
- #validation_skip_attributes=(attributes) ⇒ Object
Instance Method Details
#save ⇒ Object
43 44 45 |
# File 'lib/active_ldap/validations.rb', line 43 def save(*) valid? ? super : false end |
#save! ⇒ Object
47 48 49 |
# File 'lib/active_ldap/validations.rb', line 47 def save!(*) valid? ? super : raise(EntryInvalid.new(self)) end |
#valid?(context = nil) ⇒ Boolean
37 38 39 40 41 |
# File 'lib/active_ldap/validations.rb', line 37 def valid?(context = nil) context ||= (new_entry? ? :create : :update) output = super(context) errors.empty? && output end |
#validation_skip_attributes ⇒ Object
29 30 31 |
# File 'lib/active_ldap/validations.rb', line 29 def validation_skip_attributes @validation_skip_attributes ||= [] end |
#validation_skip_attributes=(attributes) ⇒ Object
33 34 35 |
# File 'lib/active_ldap/validations.rb', line 33 def validation_skip_attributes=(attributes) @validation_skip_attributes = attributes end |