So the error was:
Unknown action The action 'show' could not be found for UsersController
So, I went into the controller and defined the show action. Then I looked through some of the Devise docs and noticed this helper, which I then used: sign_out :user . This is a workaround:
def show sign_out :user redirect_to welcome_path end
However, this only registered the user and redirected him to the welcome_path, but then I got another error:
Unknown action The action 'show' could not be found for WelcomeController
So, I defined the show action for the hello controller:
class WelcomeController < ApplicationController def show render :index end end
This redirects the user to the root page. Voila! Then I clicked on the login button and the button on the page and saw that I was asked to enter the page. I successfully logged out and redirected the user back to the welcome index URL. Hooray !: D
However, now comes the strange part. I do not understand why this works. Therefore, from the root URL, when I put this code:
<p><%= link_to "log out", destroy_user_session_path, :method => :delete %></p>
And then click on it after logging in, it successfully logs out without additional writing to the controllers or something like that. Very smooth and no work is required, but when a user tries to exit a different page, and not a ROOT URL, it will not work, and I get this error above using the UserController .
I do not understand why the exit request requests the show action in the UserController . When is a GET request to destroy a user session. I mean, why should I point to sign:out :user inside the controller, if that is what DEVISE should take care of. Please explain this behavior.