Sha256: 1dd6f9da898712343f9b42d83830708744ee3cfdb86d2809f29637245c113a40
Contents?: true
Size: 402 Bytes
Versions: 2
Compression:
Stored size: 402 Bytes
Contents
module TbRedirects::HandleRedirects extend ActiveSupport::Concern included do rescue_from TbCore::NotFoundError, with: :check_for_applicable_redirect end def check_for_applicable_redirect(error) if redirect = TbRedirect.find_with_uri(request.original_url) redirect_to redirect.destination, status: :moved_permanently else handle_request_error(error) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tb_redirects-1.0.3 | app/controllers/concerns/tb_redirects/handle_redirects.rb |
tb_redirects-1.0.2 | app/controllers/concerns/tb_redirects/handle_redirects.rb |