Class: Backend::Redirects::TestController
- Inherits:
-
BaseController
- Object
- BaseController
- Backend::Redirects::TestController
- Defined in:
- app/controllers/backend/redirects/test_controller.rb
Instance Method Summary collapse
-
#resolve ⇒ Object
The follow_location param determines the difference between a redirect trace that runs through every nested redirect and one that stops at the first redirect in the trace.
Instance Method Details
#resolve ⇒ Object
The follow_location param determines the difference between a redirect trace that runs through every nested redirect and one that stops at the first redirect in the trace. (A nested redirect meaning that the destination of one redirect is the source of another)
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/backend/redirects/test_controller.rb', line 9 def resolve respond_to do |format| format.js do # The last redirect in a chain should always follow its location through, # because that's the only way afaik to retrieve 404/500 and other faulty # status codes, instead of the default 301. vars = { base_url: request.base_url, follow_location: @redirect.next_in_chain.blank? } if @redirect.resolves?(vars) @redirect.working! else @redirect.broken! end end end end |