I am creating a rails app. And i have login in such a way that, users are directed or redirect to /login for signing in. And when users/sign_in is passed the it embeds the sign in form into the application layout which i don't want users to see. Is there a way i can redirect users/sign_in to /login or restrict access to it ?
thanks
The following will replace the routes:
devise_for :model_name, :path => '',
:path_names => {:sign_in => 'login', :sign_out => 'logout'}
It will replace the users/sign_in and users/sign_out routes with login/logout, and the redirects will take them to those routes accordingly as well.
try this. It should works. ;)
config/routes.rb
# change :devise_model to :user, or :admin or any name of your devise model
devise_scope :devise_model do
get '/login' => "devise/sessions#new"
end
and you can use this in view like this.
link_to 'Login', login_url
PS. if you have override devise controller. You should tell the router first, and change devise controller to your override controller name.
go to this link and see Configuring controllers content.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.