Class: Wafflemix::CategoriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/wafflemix/categories_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#menu_items

Instance Method Details

#indexObject



7
8
9
10
11
12
13
14
15
# File 'app/controllers/wafflemix/categories_controller.rb', line 7

def index
  @categories = Category.all
  @tags = Post.tag_counts_on(:tags)

  respond_to do |format|
    format.html
    format.json { render json: @categories }
  end
end

#showObject



17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/wafflemix/categories_controller.rb', line 17

def show
  @category = Category.find(params[:id])
  @posts = @category.posts.published
  @tags = Post.tag_counts_on(:tags)

  respond_to do |format|
    format.html
    format.json { render json: @category }
  end
end