Class: Spree::ProductsController
Constant Summary
collapse
- HTTP_REFERER_REGEXP =
/^https?:\/\/[^\/]+\/t\/([a-z0-9\-\/]+)$/
Instance Attribute Summary
#title
Instance Method Summary
collapse
#access_forbidden, included
Instance Method Details
#index ⇒ Object
10
11
12
13
14
|
# File 'app/controllers/spree/products_controller.rb', line 10
def index
@searcher = Config.searcher_class.new(params)
@products = @searcher.retrieve_products
respond_with(@products)
end
|
#show ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/spree/products_controller.rb', line 16
def show
return unless @product
@variants = Variant.active.includes([:option_values, :images]).where(:product_id => @product.id)
@product_properties = ProductProperty.includes(:property).where(:product_id => @product.id)
referer = request.env['HTTP_REFERER']
if referer && referer.match(HTTP_REFERER_REGEXP)
@taxon = Taxon.find_by_permalink($1)
end
respond_with(@product)
end
|