tmaximini
tmaximini

Reputation: 8503

rails3 devise - no route matches "/sessions/user"

it is the first time I am working with devise and I am a confused by the massive amount of files and configuration options. Before installing devise, I used the nifty:authentication from ryan bates - which I didn't delete before installing devise and I guess now my routes and/or controllers are a little screwed up.

well, after singing in on /users/sign_in devise tries to redirect me to

http://localhost:3000/sessions/user

but I get the error:

No route matches "/sessions/user"

I don't know where is the error, any help appreciated

I put all the relevant code in a gist: https://gist.github.com/972058

thanks in advance

Upvotes: 3

Views: 3178

Answers (2)

code-gijoe
code-gijoe

Reputation: 7234

In my case, I had a session controller which was causing issues. Removing resources :sessions from the routes file should solve the problem. That was because I had previously created a session manager. Once gone, I did not see the issue again.

Upvotes: 3

Greg
Greg

Reputation: 1152

That's because you don't have root path in your routes. As you can read in devise page: https://github.com/plataformatec/devise

After signing in a user, confirming the account or updating the password, Devise will look for a scoped root path to redirect. Example: For a :user resource, it will use user_root_path if it exists, otherwise default root_path will be used. This means that you need to set the root inside your routes

To specify redirect page you need to do this https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in

btw. you don't need sessions controller to make it works

Upvotes: 1

Related Questions