Sha256: 6c4b3332772186fba81e82d199af7861544ebc576720541b58e551630c773dd9
Contents?: true
Size: 1.42 KB
Versions: 3
Compression:
Stored size: 1.42 KB
Contents
module KktShoppe class ProductCategoriesController < KktShoppe::ApplicationController before_filter { @active_nav = :product_categories } before_filter { params[:id] && @product_category = KktShoppe::ProductCategory.find(params[:id]) } def index @product_categories_without_parent = KktShoppe::ProductCategory.without_parent.ordered end def new @product_category = KktShoppe::ProductCategory.new end def create @product_category = KktShoppe::ProductCategory.new(safe_params) if @product_category.save redirect_to :product_categories, :flash => { :notice => t('kkt_shoppe.product_category.create_notice') } else render :action => "new" end end def edit end def update if @product_category.update(safe_params) redirect_to [:edit, @product_category], :flash => { :notice => t('kkt_shoppe.product_category.update_notice') } else render :action => "edit" end end def destroy @product_category.destroy redirect_to :product_categories, :flash => { :notice => t('kkt_shoppe.product_category.destroy_notice') } end private def safe_params file_params = [:file, :parent_id, :role, :parent_type, :file => []] params[:product_category].permit(:name, :permalink, :description, :parent_id, :permalink_includes_ancestors, :attachments => [:image => file_params]) end end end
Version data entries
3 entries across 3 versions & 1 rubygems