Class: Spud::Admin::PostCategoriesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/spud/admin/post_categories_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



32
33
34
35
36
37
38
39
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 32

def create
	@post_category = SpudPostCategory.new(params[:spud_post_category])
	if @post_category.save
		flash[:notice] = 'Post Category was successfully created'
		expire_post_actions
	end
	respond_with @post_category, :location => spud_admin_post_categories_path
end

#destroyObject



41
42
43
44
45
46
47
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 41

def destroy
	if @post_category.destroy
		flash[:notice] = 'Post Category was successfully deleted'
		expire_post_actions
	end
	respond_with @post_category, :location => spud_admin_post_categories_path
end

#editObject



15
16
17
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 15

def edit
	respond_with @post_category
end

#indexObject



10
11
12
13
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 10

def index
	@post_categories = SpudPostCategory.order('name asc').includes(:posts).paginate(:page => params[:page], :per_page => 15)
	respond_with @post_categories
end

#newObject



27
28
29
30
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 27

def new
	@post_category = SpudPostCategory.new
	respond_with @post_category
end

#updateObject



19
20
21
22
23
24
25
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 19

def update
	if @post_category.update_attributes(params[:spud_post_category])
		flash[:notice] = 'Post Category was successfully updated' 
		expire_post_actions
	end
	respond_with @post_category, :location => spud_admin_post_categories_path
end