Get Devise's model name
I have:
devise_for :users
devise_for :admins
Then, on Sign In page, i want to show 'Ad开发者_C百科min Sign In' title when someone tries to access /admins/sign_in
How it could be done?
Use scoped views, they're described in the devise documentation, in the "Configuring views section".
Run:
rails generate devise:views admins
and set the following in config/initializers/devise.rb
:
config.scoped_views = true
You can then modify app/views/admins/sessions/new.html.erb
, which will only get used when logging in as an admin.
If the view does not exist, it will fall back on app/views/devise/sessions/new.html.erb
.
If you're just looking to change the title of the page in the admin sign in view you could change the title in your routes file as follows:
devise_for :admins, :path_names => { :sign_in => "Admin Sign In" }
精彩评论