Sha256: b084b430a11b964acc8a1fd6dc4198288a5fa5fdaf1f5cb29a59603e2ae626dd
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 KB
Contents
module Tienda class ProductCategoriesController < Tienda::ApplicationController before_filter { @active_nav = :product_categories } before_filter { params[:id] && @product_category = Tienda::ProductCategory.find(params[:id]) } def index @product_categories = Tienda::ProductCategory.root.ordered.includes(:children) end def new @parents = Tienda::ProductCategory.all @product_category = Tienda::ProductCategory.new end def create @product_category = Tienda::ProductCategory.new(safe_params) if @product_category.save redirect_to :product_categories, flash: { notice: t('tienda.product_category.create_notice') } else render action: "new" end end def edit @parents = Tienda::ProductCategory.all end def update if @product_category.update(safe_params) redirect_to [:edit, @product_category], flash: { notice: t('tienda.product_category.update_notice') } else render action: "edit" end end def destroy @product_category.destroy redirect_to :product_categories, flash: { notice: t('tienda.product_category.destroy_notice') } end private def safe_params params[:product_category].permit(:name, :permalink, :description, :image, :parent_id) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tienda-2.1.3 | app/controllers/tienda/product_categories_controller.rb |
tienda-2.1.2 | app/controllers/tienda/product_categories_controller.rb |