Module: Devise::Orm::DirtyTrackingMongoidMethods

Defined in:
lib/devise/orm.rb

Instance Method Summary collapse

Instance Method Details

#devise_email_before_last_saveObject



48
49
50
# File 'lib/devise/orm.rb', line 48

def devise_email_before_last_save
  respond_to?(:email_previously_was) ? email_previously_was : email_was
end

#devise_email_in_databaseObject



52
53
54
# File 'lib/devise/orm.rb', line 52

def devise_email_in_database
  email_was
end

#devise_respond_to_and_will_save_change_to_attribute?(attribute) ⇒ Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/devise/orm.rb', line 75

def devise_respond_to_and_will_save_change_to_attribute?(attribute)
  respond_to?("#{attribute}_changed?") && send("#{attribute}_changed?")
end

#devise_saved_change_to_email?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/devise/orm.rb', line 56

def devise_saved_change_to_email?
  respond_to?(:email_previously_changed?) ? email_previously_changed? : email_changed?
end

#devise_saved_change_to_encrypted_password?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/devise/orm.rb', line 60

def devise_saved_change_to_encrypted_password?
  respond_to?(:encrypted_password_previously_changed?) ? encrypted_password_previously_changed? : encrypted_password_changed?
end

#devise_unconfirmed_email_will_change!Object



68
69
70
71
72
73
# File 'lib/devise/orm.rb', line 68

def devise_unconfirmed_email_will_change!
  # Mongoid's will_change! doesn't force unchanged attributes into updates,
  # so we override changed_attributes to make it see a difference.
  unconfirmed_email_will_change!
  changed_attributes["unconfirmed_email"] = nil
end

#devise_will_save_change_to_email?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/devise/orm.rb', line 64

def devise_will_save_change_to_email?
  email_changed?
end