更改设计默认根

时间:2012-08-15 12:54:46

标签: ruby-on-rails-3 devise

我的根页面是一个欢迎页面,其中包含一个打开注册模式的链接。

我有需要身份验证的特定页面。当我转到该特定页面时,我被重定向到localhost:3000 / users / sign_in。但我想将用户重定向到我的主页并显示模态。我的意思是我希望登录页面是localhost:3000 /并且不知何故,只是在这种情况下传递一个参数,让我知道我必须打开弹出窗口。

我是说, 当我去localhost:3000时,我应该只显示主屏幕。

但是如果我去localhost:3000 / myspecificpagewithauthentication我应该被重定向到localhost:3000?showsignup = true(为了能够使用JS显示模态)并且在注册后我应该再次重定向到localhost: 3000 / myspecificpagewithauthentication(已经过身份验证)。

我正在使用Devise和RoR 3.

有任何帮助吗?感谢。

1 个答案:

答案 0 :(得分:4)

设计是一个记录良好的宝石。 here你去了

<强>更新

在登录路径后更改,将自己的after_sign_in_path_for方法写入应用程序控制器。这将覆盖设计方法。

class ApplicationController < ActionController::Base

def after_sign_in_path_for(resource)
  your_custom_path
end

end