[英]Devise routing rails 4
Hi i am new to rails so any help will be much appreciated. 嗨,我是新来的Rails,所以任何帮助将不胜感激。 I have successfully installed the gem devise.
我已经成功安装了gem devise。 I have two table in my schema;
我的架构中有两个表; Userrs (recruiters) & Userj (jobseekers).
用户(招聘人员)和Userj(求职者)。
Question: i want to write a method that states if registered user is Userrs (recruiters) go to recruiters_path else if user is Userj (jobseekers) go to jobseekers_path.
问题:我想编写一种方法,说明注册用户是否为Userrs(招聘人员)是否进入招聘者路径,如果用户为Userj(jobseekers)则转到Jobseekers_path。 Any help or advise will be much appreciated.
任何帮助或建议将不胜感激。
application controller 应用控制器
def after_sign_in_path_for(resource_or_scope)
if is_userr?(current_userr)
recruiters_path
else
jobseekers_path
end
end
any help would be much appreciated. 任何帮助将非常感激。
在控制器中写:
if userr_signed_in?
redirect_to recruiters_path
else
redirect_to jobseekers_path
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.