Sha256: a988adaac051c07cae28cab4ede517080e4935a6689a830314e9839c5e69aa8a
Contents?: true
Size: 753 Bytes
Versions: 21
Compression:
Stored size: 753 Bytes
Contents
module Locomotive::Steam module Middlewares # If an old URL has been found among the site url_redirections hash, # perform a 310 redirection to the new URL. # It is highly useful when the site existed before but was ran by another system. # # See the specs (spec/unit/middlewares/url_redirection_spec.rb) for more details. # class UrlRedirection < ThreadSafe include Helpers def _call if url = redirect_url redirect_to url end end protected def redirect_url return false if site.url_redirections.nil? || site.url_redirections.size == 0 site.url_redirections.to_h[request.env['locomotive.path'] || request.fullpath] end end end end
Version data entries
21 entries across 21 versions & 1 rubygems