改变Devise的sign_in网址 [英] Changing the sign_in url for Devise
本文介绍了改变Devise的sign_in网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在帖子控制器中具有以下内容。
例如:
class PostsController< ApplicationController
before_filter:authenticate_user!
def index
@posts = Post.all
end
end
此刻它会自动转到'/ users / sign_in'
我想使用'/ login' >
解决方案
使用devise_for方法为现在排序。
devise_for:users,:controllers => {:registrations => 'registrations'},:path => 'accounts',:path_names => {:sign_in => 'login',:sign_up => 'new',:sign_out => 'logout',:password => 'secret',:confirmation => '验证'}
所以现在sign_in路径是'accounts / login'
How do you change the sign in path for Devise when using a before_filter :athenticate user?
I have the following in a Posts controller.
eg:
class PostsController < ApplicationController
before_filter :authenticate_user!
def index
@posts = Post.all
end
end
At the moment it automatically goes to '/users/sign_in'
I'd like to use '/login'
解决方案
Sorted for now folks, using the devise_for method.
devise_for :users, :controllers => { :registrations => 'registrations' }, :path => 'accounts', :path_names => { :sign_in => 'login', :sign_up => 'new', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification' }
So now the sign_in path is 'accounts/login'
这篇关于改变Devise的sign_in网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文