blob: ea4906f2a607a69e1310c1bfda6c443eef418a3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
class ProductsController < ApplicationController
def initialize(product_api = Spank::IOC.resolve(:product_api))
@product_api = product_api
super()
end
def index
@products = @product_api.search(params[:q])
if @products.count == 1
redirect_to product_path(@products.first.asin)
end
end
def show
@product = @product_api.find(params[:id])
end
end
|