Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined local variable or method `authentication_keys' #13

Open
benwoody opened this issue Dec 29, 2011 · 4 comments
Open

undefined local variable or method `authentication_keys' #13

benwoody opened this issue Dec 29, 2011 · 4 comments

Comments

@benwoody
Copy link

Repro

Building an app from scratch. After running

rails generate devise:install
rails generate couchrest_model:devise User

Running rake routes throws:

undefined local variable or method `authentication_keys' for User:Class

More Info

Base User model of:

class User < CouchRest::Model::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable

end

config/initializer/devise.rb contains (shortened):

Devise.setup do |config|

  require 'devise/orm/couchrest_model'

end

config/application.rb contains (shortened):

require File.expand_path('../boot', __FILE__)

# require 'rails/all'
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"
require "couchrest_model"

end

Devise related gems installed:

  • couchrest (1.1.2 239e6c9)
  • couchrest_model (1.1.2 819ddb7)
  • devise (2.0.0.rc f712d07)
  • devise_couch (1.0.0.beta2 4fc35f7)
  • orm_adapter (0.0.3 dcf9cd3)

Full rake error at:
https://gist.github.com/1532865

@shenoudab
Copy link
Owner

Hallo Ben,

you can update /config/initializers/devise.rb and activate config.authentication_keys = [ :email ]
which will may help in your error, also please refer to the example project of devise_couch

    http://github.com/shenoudab/devise_couch_example

@benwoody
Copy link
Author

config.authentication_keys = [ :email ] is uncommented. Is this reproducible? I can pick through the example some more, but the only difference I seem to find is the version of gems used. (2.0.0 in my example, 1.2.rc in yours)

Also, using the devise_couch_example with the updated gems for Devise 2.0.0, couchrest 1.1.2, and couchrest_mode1.1.2, seem to break your example as well. Does devise_couch not work with any version of these above whats listed in your Gemfile?

~ben

@benwoody
Copy link
Author

I've played with your example a bit and it seems to break only with Rails 3.1.3

The error is being thrown in lib/devise/orm/couchrest_model.rb

def create_authentication_views
          authentication_keys.each do |key_name|
            view_by key_name
          end

@shenoudab
Copy link
Owner

kindly, rails 3.1.3 is not tested yet.
all pulls are welcome for devise_couch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants