0
我刚刚在我的RoR应用程序中安装了Devise。 我希望我的根网站(http://site.com)显示设计注册页面。如何将注册页面设置为主页
如果用户已经登录,则重定向到用户仪表板。但是,如果用户转到http://site.com/dashboard并且未记录,则重定向到用户可以看到注册的主页。
我该怎么做?
谢谢
UPDATE:
在我的routes.rb有
root :to => 'users#index'
,这在我的users_controller:
def index
if user_signed_in?
render 'dashboard'
else
redirect_to new_user_registration_path
end
end
这是正确的吗?
什么认证?我不应该使用before_filter吗? – 2011-04-11 23:45:50
验证是一个设计具体的方法,你可以使用你的路线...看到这里:http://rdoc.info/github/plataformatec/devise/master/ActionDispatch/Routing/Mapper#authenticate-instance_method – 2011-04-11 23:48:08
@迈克刘易斯看我的更新后的问题 – 2011-04-11 23:54:53