Class: BookmarkableComparison

Inherits:
Object
  • Object
show all
Defined in:
app/metal/bookmarkable_comparison.rb

Class Method Summary collapse

Class Method Details

.call(env) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'app/metal/bookmarkable_comparison.rb', line 3

def self.call(env)
  req = Rack::Request.new(env)
  
  if req.path_info =~ /^\/compare_products/
    products = (req.params['product_id'] || []).join('/')
    url = "/t/#{req.params['taxon']}/compare/#{products}"
    return [303, {"Location" => url}, []]
  end
  
  [ 404, { 'Content-Type' => 'text/html' }, [ 'Not Found' ] ]
end