设计登录根路径栏目3 [英] Devise logged in root route rails 3
本文介绍了设计登录根路径栏目3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Heyya 个人。
所以我想到这个coolio的想法,如果你登录然后你得到某种仪表板,否则你得到一个信息/登录/注册页面..所以我该怎么做..
我主要想在路线中这样做,不像
def index
如果current_user.present?
render:action =>'logged_in'
else
render:action =>'logged_out'
end
end
提前感谢
/ Oluf Nielsen
认证: user do
root:to => dashboard#show
end
root:to => devise / sessions#new
注意:它的验证* d *
Heyya guys. So i thought about this coolio idea, if you are logged in then you get some sort of dashboard, else you get an information/login/sign up page.. So how do i do that..
I mostly wants to do this in Routes = not something like
def index
if current_user.present?
render :action => 'logged_in'
else
render :action => 'logged_out'
end
end
thanks in advance!
/ Oluf Nielsen
解决方案
Think you may have been looking for this:
authenticated :user do
root :to => "dashboard#show"
end
root :to => "devise/sessions#new"
Note: it's authenticate*d*
这篇关于设计登录根路径栏目3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文