Skip to content

After upgrade to 2.2.0, NoMethodError: undefined method `email' for #2204

Description

@3dd13

I am using the authentication_keys in my model which does not have email field.

  devise :database_authenticatable, :token_authenticatable, :authentication_keys => [:full_phone_no]

the error is thrown when I create an instance. stacktrace:

gems/activerecord-3.2.11/lib/active_record/attribute_methods.rb:149:in `method_missing'
gems/devise-2.2.0/lib/devise/models/authenticatable.rb:173:in `apply_to_attribute_or_variable'
gems/devise-2.2.0/lib/devise/models/authenticatable.rb:165:in `block in downcase_keys'
gems/devise-2.2.0/lib/devise/models/authenticatable.rb:165:in `each'
gems/devise-2.2.0/lib/devise/models/authenticatable.rb:165:in `downcase_keys'

the error should be because the line authenticatable.rb:163

def downcase_keys
  self.class.case_insensitive_keys.each { |k| apply_to_attribute_or_variable(k, :downcase!) }
end

so, to make it working in the latest version 2.2.0, I have to clear out config.case_insensitive_keys

# default
# config.case_insensitive_keys = [:email]
config.case_insensitive_keys = []

is it expected behavior ?
should we include it in the wiki or upgrade notes ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions