The route should be
devise_for :admins
If you want to keep the route, Change the view folder to app/views/admin/
题
I have read all stackoverflow posts and the document on https://github.com/plataformatec/devise concerning the scoped Devise views in a Rails application.
I have a single model Admin. Later I am planning to add other models such as User. My problem is that my scoped views do not work. Here is what I have done:
I modified the file config/initializers/devise.rb
: added config.scoped_views = true
.
Then I generated a session view (using rails g devise:views -v sessions
) new.html.erb
, modified it and put this file in the folder app/views/admins/sessions
.
I restarted the Rails server and followed the http://0.0.0.0:3000/admin/sign_in
.
Nothing changed.
Then I put the file new.html.erb
into the folder app/views/admins/sessions/new
, again no effect.
Additional info: routes.rb
contains devise_for :admin
.
Does anyone have idea what I am missing?
解决方案
The route should be
devise_for :admins
If you want to keep the route, Change the view folder to app/views/admin/