【问题标题】:Redirect_to claims to work, but doesn't actually happen in the browserRedirect_to 声称可以工作,但实际上并没有在浏览器中发生
【发布时间】:2018-09-07 17:19:34
【问题描述】:

这是我调用重定向的控制器代码:

def helpful
  flash[:notice] = I18n.t(:thanks_for_feedback)
  redirect_to :back
end

日志声称:

Redirected to http://localhost:3000/p/anime/2?page=1
Completed 302 Found in 3147.7ms (Searchkick: 857.1ms)

但是,浏览器中实际上什么也没发生(Chrome,如果重要的话)。

【问题讨论】:

    标签: ruby-on-rails-4 redirect http-status-code-302


    【解决方案1】:

    您可能正在使用 AJAX 请求。

    如果是这样,请看:Rails 3: How to "redirect_to" in Ajax call?

    【讨论】:

      猜你喜欢
      • 2015-11-05
      • 2019-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-17
      • 2019-02-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多