Sha256: 49492eb22e7d16b73b0f4308ff89ef449b6560570d4e6a94e230e9996f58e818

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 KB

Contents

module Shoppe
  class ProductCategoriesController < Shoppe::ApplicationController

    before_filter { @active_nav = :product_categories }  
    before_filter { params[:id] && @product_category = Shoppe::ProductCategory.find(params[:id]) }
  
    def index
      @product_categories = Shoppe::ProductCategory.ordered.all
    end
  
    def new
      @product_category = Shoppe::ProductCategory.new
    end
  
    def create
      @product_category = Shoppe::ProductCategory.new(safe_params)
      if @product_category.save
        redirect_to :product_categories, :flash => {:notice => "Category has been created successfully"}
      else
        render :action => "new"
      end
    end
  
    def edit
    end
  
    def update
      if @product_category.update(safe_params)
        redirect_to [:edit, @product_category], :flash => {:notice => "Category has been updated successfully"}
      else
        render :action => "edit"
      end
    end
  
    def destroy
      @product_category.destroy
      redirect_to :product_categories, :flash => {:notice => "Category has been removed successfully"}
    end
  
    private
  
    def safe_params
      params[:product_category].permit(:name, :permalink, :description, :image_file)
    end
  
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shoppe-1.0.2 app/controllers/shoppe/product_categories_controller.rb
shoppe-1.0.1 app/controllers/shoppe/product_categories_controller.rb
shoppe-1.0.0 app/controllers/shoppe/product_categories_controller.rb
shoppe-0.0.21 app/controllers/shoppe/product_categories_controller.rb
shoppe-0.0.20 app/controllers/shoppe/product_categories_controller.rb
shoppe-0.0.19 app/controllers/shoppe/product_categories_controller.rb
shoppe-0.0.18 app/controllers/shoppe/product_categories_controller.rb
shoppe-0.0.17 app/controllers/shoppe/product_categories_controller.rb
shoppe-0.0.16 app/controllers/shoppe/product_categories_controller.rb
shoppe-0.0.15 app/controllers/shoppe/product_categories_controller.rb