How can I reload the current page in Ruby on Rails?

后端 未结 9 1547

I currently have a login popup in my header bar which is on every page in my website. I want to be able to reload the current page that the person is on after a successful

9条回答
  •  失恋的感觉
    2020-12-28 12:28

    Rails 5 introduced alternative function:

    redirect_back(fallback_location: root_path)
    

    It redirect back whenever the HTTP_REFERER is known. Otherwise it redirects to the fallback_location.

    The redirect_to :back is deprecated in Rails 5.0 https://github.com/rails/rails/pull/22506 and removed since Rails 5.1

提交回复
热议问题