Class: RedirectLegacyProductUrl
- Inherits:
-
Object
- Object
- RedirectLegacyProductUrl
- Defined in:
- lib/redirect_legacy_product_url.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ RedirectLegacyProductUrl
constructor
A new instance of RedirectLegacyProductUrl.
Constructor Details
#initialize(app) ⇒ RedirectLegacyProductUrl
Returns a new instance of RedirectLegacyProductUrl.
2 3 4 |
# File 'lib/redirect_legacy_product_url.rb', line 2 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/redirect_legacy_product_url.rb', line 6 def call(env) if env["PATH_INFO"] =~ %r{/t/.+/p/(.+)} return [301, {'Location'=> "/products/#{$1}" }, []] end @app.call(env) end |