开发者

Rails 3.0.9 + Ruby 1.9.2 p180 + Devise - Routes

开发者 https://www.devze.com 2023-03-14 05:50 出处:网络
I\'m using Rails 3.0.9 + Ruby 1.9.2 p180 开发者_JS百科+ Devise, and here\'s my routes: [...] devise_for :users,:controllers => { :sessions => \"users/sessions\" }

I'm using Rails 3.0.9 + Ruby 1.9.2 p180 开发者_JS百科+ Devise, and here's my routes:

[...]
devise_for :users,:controllers => { :sessions => "users/sessions" }
[...]
root :to => "users/sessions#new"

I basically wanted to make the devise login page my root route... But when I try to it my local server (http://localhost:3000), I get the following error:

Unknown action

Could not find devise mapping for path "/". Maybe you forgot to wrap your route inside
the scope block? For example: devise_scope :user do match "/some/route" => 
"some_devise_controller" end


Try this:

devise_scope :user do 
  root :to => "users/sessions#new"
end

Edit: if you were using devise's default controllers then you would do this:

devise_scope :user do 
  root :to => "devise/sessions#new"
end
0

精彩评论

暂无评论...
验证码 换一张
取 消