default page sign_in

37 views
Skip to first unread message

Elton Santos

unread,
Sep 3, 2015, 10:59:16 PM9/3/15
to Devise
Hi! How configure devise for default page is sign_in page?
My code:

in routes.rb

devise_for :users do
    get "/", to: "devise/sessions#new"
end

root to: 'devise/sessions#new'


When I acess localhost:3000, I have show the sign_in page, but show this error:


Could not find devise mapping for path "/". This may happen for two reasons: 1) You forgot to wrap your route inside the scope block. For example: devise_scope :user do get "/some/route" => "some_devise_controller" end 2) You are testing a Devise controller bypassing the router. If so, you can explicitly tell Devise which mapping to use: @request.env["devise.mapping"] = Devise.mappings[:user]



I have model user.rb and views generates. Whats make? Thanks!

Elton Santos

unread,
Sep 3, 2015, 11:28:32 PM9/3/15
to Devise
* PS: Using rails 4.2.4, last version Ruby and Devise.

atishb

unread,
Sep 5, 2015, 3:01:44 AM9/5/15
to Devise
You're missing the devise_scope. Can also be substituted with the alias as. Edited Inline.


On Friday, 4 September 2015 08:29:16 UTC+5:30, Elton Santos wrote:
Hi! How configure devise for default page is sign_in page?
My code:

in routes.rb

devise_scope :users do
    get "/", to: "devise/sessions#new"
end

root to: 'devise/sessions#new'
Reply all
Reply to author
Forward
0 new messages