вы можете добавить пользовательский ActiveSupport::Subscriber как показано ниже
# app/subscribers/specify_redirected_subscriber
class SpecifyRedirectedSubscriber < ActiveSupport::Subscriber
attach_to :action_controller
SPECIFY_REDIRECTED = [/your-domain\/view\/category\/\d/] # view/category/id
def redirect_to(event)
redirected_link = event.payload[:location]
matched = SPECIFY_REDIRECTED.filter { |specify_link|
specify_link.match(redirected_link)
}
unless matched.blank?
# log what you want
Rails.logger.info { "Specify Redirected To #{redirected_link}" }
end
end
end
тогда вы можете добавить этого подписчика внизу приложения
class ApplicationController < ActionController::Base
# ...
end
SpecifyRedirectedSubscriber