Class: Comable::Admin::ProductsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Comable::Admin::ProductsController
- Defined in:
- app/controllers/comable/admin/products_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/controllers/comable/admin/products_controller.rb', line 17 def create if @product.update_attributes(product_params) redirect_to comable.admin_product_path(@product), notice: Comable.t('successful') else flash.now[:alert] = Comable.t('failure') render :new end end |
#destroy ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'app/controllers/comable/admin/products_controller.rb', line 35 def destroy if @product.destroy redirect_to comable.admin_products_path, notice: Comable.t('successful') else flash.now[:alert] = Comable.t('failure') render :edit end end |
#index ⇒ Object
12 13 14 15 |
# File 'app/controllers/comable/admin/products_controller.rb', line 12 def index @q = Comable::Product.ransack(params[:q]) @products = @q.result.includes(:stocks).page(params[:page]).accessible_by(current_ability) end |
#show ⇒ Object
8 9 10 |
# File 'app/controllers/comable/admin/products_controller.rb', line 8 def show render :edit end |
#update ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/controllers/comable/admin/products_controller.rb', line 26 def update if @product.update_attributes(product_params) redirect_to comable.admin_product_path(@product), notice: Comable.t('successful') else flash.now[:alert] = Comable.t('failure') render :edit end end |