Module: Devise::Models::Compatibility::MongoidPatch

Extended by:
ActiveSupport::Concern
Defined in:
lib/devise-security/models/compatibility/mongoid_patch.rb

Instance Method Summary collapse

Instance Method Details

#update_attribute_without_validatons_or_callbacks(name, value) ⇒ Object

Updates the document with the value and does not trigger validations or callbacks

Parameters:

  • name (Symbol)

    attribute to update

  • value (String)

    value to set



25
26
27
# File 'lib/devise-security/models/compatibility/mongoid_patch.rb', line 25

def update_attribute_without_validatons_or_callbacks(name, value)
  set(Hash[*[name, value]])
end

#will_save_change_to_email?Boolean

Will saving this record change the email attribute?

Returns:

  • (Boolean)


12
13
14
# File 'lib/devise-security/models/compatibility/mongoid_patch.rb', line 12

def will_save_change_to_email?
  changed.include? 'email'
end

#will_save_change_to_encrypted_password?Boolean

Will saving this record change the encrypted_password attribute?

Returns:

  • (Boolean)


18
19
20
# File 'lib/devise-security/models/compatibility/mongoid_patch.rb', line 18

def will_save_change_to_encrypted_password?
  changed.include? 'encrypted_password'
end