Sha256: 0618f3af8b6f294b06dcfb3a342d018a49703d8eeeda9909a48fcc9fe3cce856

Contents?: true

Size: 828 Bytes

Versions: 7

Compression:

Stored size: 828 Bytes

Contents

module Adminpanel
	class CategoriesController < Adminpanel::ApplicationController
		def index
			@categories = Category.all
		end

		def new
			@category = Category.new
		end

		def create
			@category = Category.new(params[:category])
			if @category.save
				redirect_to categories_path, :notice => t("category.success")
			else
				render "new"
			end
		end

		def edit
			@category = Category.find(params[:id])
		end

		def update
			@category = Category.find(params[:id])

			if @category.update_attributes(params[:category])
				redirect_to categories_path, :notice => "#{@category.name} ha sido actualizado con exito"
			else
				render "edit"
			end
		end

		def destroy
			@category = Category.find(params[:id])
			@category.destroy

			redirect_to categories_path
		end
	end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
adminpanel-0.1.1 app/controllers/adminpanel/categories_controller.rb
adminpanel-0.1.0cl.2 app/controllers/adminpanel/categories_controller.rb
adminpanel-0.1.0cl app/controllers/adminpanel/categories_controller.rb
adminpanel-0.1.0 app/controllers/adminpanel/categories_controller.rb
adminpanel-0.0.7 app/controllers/adminpanel/categories_controller.rb
adminpanel-0.0.6.1 app/controllers/adminpanel/categories_controller.rb
adminpanel-0.0.6 app/controllers/adminpanel/categories_controller.rb