1
votes

I have set up rails with devise however I can't get my authentication to work when I add the confirmable module to my application. I included the confirmable module in my User model and uncommented confirmable and the add_index confirmation token in my migration file. After rolling back the database and re-commenting these, the authentication works as specified.

I have also checked and I can't sign out of the application, even though I have provided the <%= link to "Sign Out", destroy_user_session_path %> My application gets a routing error, no route matches [GET] users/sign_out. When I run rake routes this route is available to me as

destroy_user_session DELETE /users/sign_out(.:format)      {:action=>"destroy", :controller=>"devise/sessions"}  
2

2 Answers

5
votes

Not sure about the confirmable part, but I can tell you that the link you're using is calling a GET method. As you can see, to sign out you need a DELETE method in your link which will look like this:

<%= link_to "Sign out", destroy_user_session_path, :method => :delete %>

If you want to use GET for sign out specifically, check out the devise initializer file; somewhere at the bottom you'll see something about signing out and the default method being :delete. put this line there:

config.sign_out_via = :get
0
votes

The work around that I applied is as follows: I had a conflict with the blueprint framework as it already provides an alert and notice class. If you look at devise's wiki it will have a subsection that deals with this issue. Then in order to confirm a new user, I went into the console, found the first user, and used the provided confirm! method that devise has in its documentation.