0

我正在开发一个在 ruby​​-on-rails 中开发的大礼包电子商务,当您从管理面板注销时,您将被带到商店主页。从管理员注销后,我需要留在管理部分(登录页面)。问题是我已经安装了'spree_auto_devise' gem,我不知道如何在用户销毁方法之后覆盖路由。

有人可以帮我吗?

4

1 回答 1

0

要更改默认注销行为以保持在同一页面上,只需将此代码添加到 .../your-spree-website/app/controllers/application_controller.rb

def after_sign_out_path_for(resource_or_scope)
  URI.parse(request.referer).path if request.referer
end

我在这里找到了解决方案:https ://github.com/plataformatec/devise/wiki/How-To:-redirect-to-a-specific-page-on-successful-sign_in,-sign_out,-and-or-sign_up

于 2014-12-10T03:09:35.330 回答