Using devise with Rails 3 beta
-
23-09-2019 - |
문제
I'm currently trying to use Devise 1.1.pre3 as authentication in my upcoming project, but I can't get it to work properly.
I have done everything it says in the documentation, installed warden and the correct Devise version, run the install and used the generator to create the model. But when I try to access the sign up form (localhost:3000/users/sign_up) all I get is
No route matches "/users/sign_up"
But when I run rake routing
I get the following:
...
GET /users/sign_up(.:format) {:controller=>"devise/registrations", :action=>"new"}
...
I doesn't have any files matching that controller.
Is there any steps I have missed (installed, updated routing etc and created model)
해결책
I think the default sign_in path would be /users/sign_in.
You can override this in the route by passing it :path_names => {:sign_in => "login", :sign_out => "logout"}
Then you would login with /users/login, and logout with /users/logout.
다른 팁
you should scope the relevant model in the routes.. eg..
devise_scope :user do
get "register" => "devise/registrations#new"
get "login" => "devise/sessions#new"
get "logout" => "devise/sessions#destroy"
end