How to make the sign in page the root page on devise

You can’t just use

root :to => 'devise/session#new'

because you will get this

Could not find devise mapping for path "/"

So you have to do this

devise_for :users do
  root :to => 'dashboard#index', :constraints => lambda {|r| r.env["warden"].authenticate? }
  root :to => 'devise/sessions#new'
end