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



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

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)


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

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)


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

def will_save_change_to_encrypted_password?
  changed.include? 'encrypted_password'
end