开发者

Get Devise's model name

开发者 https://www.devze.com 2023-04-08 12:44 出处:网络
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

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" }

0

精彩评论

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