I followed the instructions in the README to get set up, except I installed Devise by adding gem 'devise' to my Gemfile. It installed 1.1.2.
I tried access a protected controller and received this error.
undefined method 'new_application_user_session_path' for #<Devise::FailureApp::0x60aldc0>
Updated to 1.1.3 by modifying my Gemfile to gem 'devise', '1.1.3'. I tried accessing the same controller and got the same error.
gem 'devise', '1.1.3'
I should also mention that I do not see the routes when I run rake routes.
My routes.rb: http://pastie.org/1270337
My Gemfile: http://pastie.org/1270450
My migration file: http://pastie.org/pastes/1270573
NOTE: In case anyone is wondering, I will be authenticating using LDAP. So that's why you don't see t.database_authenticatable
My model file application_user.rb: http://pastie.org/pastes/1270586
My devise.rb initalizer file: http://pastie.org/pastes/1270597
NOTE: Because I will be authenticating against LDAP, I am using a different column other than the default email column that Devise defaults to. As a result, I had to install the Devise views (rails g devise:views) and modify the app/views/devise/session/new.html.erb file to use user_ldap_id instead of email.
rails g devise:views
NOTE: I removed any irrelevant code from these snippets.
have you added devise_for :user in routes?
Yep! The rails g devise MODEL command will do that for you.
rails g devise MODEL
can you provide some test app maybe?
I'll do that tonight, but I'll also provide more detail in this ticket.
I added my routes.rb and Gemfile.
I added all the files that are relevant to Devise, except for the session/new.html.erb file that I had to modify. I simply changed :email to :user_ldap_id.
there is no new_application_user_session_path (and sign_in route) because model dont have :database_authenticatable
So even though I don't need it, I have to include it for Devise to work?
yea if you using only devise, but check this out https://github.com/cschiewek/devise_ldap_authenticatable it will add :ldap_authenticatable instead of :database_authenticatable
Nice. So I installed Devise LDAP Authenticatable and now the routes are showing. However, accessing the protected controller again, I get an error saying:
undefined constant ApplicationController::DeviseLdapAuthenticatable
This is coming from the lines that Devise LDAP Authenticatable injects into my ApplicationController to catch a DeviseLdapAuthenticatable::LdapException. This is not entirely necessary at the moment, so I comment it out.
I check my routes again, just to be sure they're still there, and they are. So I try accessing my protected controller again, and I'm getting the same error as before.
I just want to test this out and see the sign-in page. That way I know that Devise is working. The LDAP side of things I'll worry about later.
wecome controller is protected. it redirects to sign_in page.
I don't see anything in your Gemfile, so I'm assuming you installed the gem directly (i.e., gem install). Is this important?
https://github.com/slbug/ldaptest/blob/master/Gemfile check once again. it always was here.
Sorry. It's been a late night. I'll take a closer look.
Comparing your routes.rb against mine, is it important to remove existing resource definition for application_user? More specifically, I have both a devise_for :application_users and a resources :application_users in mine. Do I need to get rid of the latter?
if resources defined after devise_for then everything should be ok
That worked! Thanks!
Though simply restarting the server didn't seem to apply the changes. For whatever reason, I had to stop the server, cd out of my project directory, and then start the server again.
Thanks again for all the help. Really appreciate it!