如何使用devise gem重定向到欲望页面,并将root_path设置为sign_in页面?

时间:2013-12-20 09:41:52

标签: devise ruby-on-rails-4

我已将范围添加到我的设计代码

devise_scope :authorizes do
 authenticated :authorizes do
   root :to => "auth#main"
end
  unauthenticated :authorizes do
   root :to => "devise/session#new"
  end
end
root :to => "auth#main"
  1. scope
  2. 中有什么问题 {li>错误localhost:3000NO route matches [get] "/"

    谢谢。

1 个答案:

答案 0 :(得分:0)

更新 application_controller

def after_sign_in_path_for(resource)
  if authorize_signed_in?
    amain_path
  end
end

def after_sign_out_path_for(resource)
  if authorize_signed_in?
    new_authorize_session_path
  end
end