diff options
| author | luu <luuduong@gmail.com> | 2014-12-13 16:41:51 +0000 |
|---|---|---|
| committer | luu <luuduong@gmail.com> | 2014-12-13 16:41:51 +0000 |
| commit | 50b94a4ff8a2f462ceb4e8a4f5286683b4ef0e8b (patch) | |
| tree | d87c96d5a1328812ead05464d26e64bbb842373a /app/controllers/admin/products_controller.rb | |
| parent | 0a61f5240d1fa127a9bb9bdd0a39ffd84dc8bfb9 (diff) | |
add tool only if it is not in the toolbox.
Diffstat (limited to 'app/controllers/admin/products_controller.rb')
| -rw-r--r-- | app/controllers/admin/products_controller.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/admin/products_controller.rb b/app/controllers/admin/products_controller.rb index 0c4eb32d..a4f081a6 100644 --- a/app/controllers/admin/products_controller.rb +++ b/app/controllers/admin/products_controller.rb @@ -1,5 +1,7 @@ module Admin class ProductsController < AdminController + attr_reader :product_api + def initialize(product_api = Spank::IOC.resolve(:product_api)) @product_api = product_api super() @@ -10,12 +12,13 @@ module Admin end def show - @product = @product_api.find(params[:id]) + @product = product_api.find(params[:id]) + @tool = Tool.find_by(:asin=>params[:id]) end def create Tool.create(:name=>params[:name],:asin=>params[:asin]) - redirect_to admin_products_path(params[:asin]) + redirect_to admin_product_path(params[:asin]) end end end |
