Module: Rails::Htmx::Controller
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/rails-htmx/controller.rb
Instance Method Summary collapse
-
#redirect_to(url_options = {}, response_status = {}) ⇒ Object
The templates for new generated Rails 7.0+ apps use 303 for redirects: github.com/rails/rails/commit/5ed37b35d666b833a github.com/rails/rails/commit/d6715c72c50255ccc.
Instance Method Details
#redirect_to(url_options = {}, response_status = {}) ⇒ Object
The templates for new generated Rails 7.0+ apps use 303 for redirects: github.com/rails/rails/commit/5ed37b35d666b833a github.com/rails/rails/commit/d6715c72c50255ccc
We might be able to remove this method in the future.
22 23 24 25 26 27 28 29 30 |
# File 'lib/rails-htmx/controller.rb', line 22 def redirect_to( = {}, response_status = {}) return_value = super # Return 303 to make sure a GET request will be used to display the redirect. # Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303 self.status = 303 if htmx_request? && !request.get? && !request.post? return_value end |