Sha256: 6aa9bfd8089811cd1355d3abef11581fe5862c4b30c4026ca97f7dd1037af7c4

Contents?: true

Size: 711 Bytes

Versions: 4

Compression:

Stored size: 711 Bytes

Contents

require_dependency "wafflemix/application_controller"

module Wafflemix
  class CategoriesController < ApplicationController
    before_filter :find_page

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

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

    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

    private
      def find_page
        @page = Page.find_by_title("Blog")
      end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wafflemix-0.0.4 app/controllers/wafflemix/categories_controller.rb
wafflemix-0.0.3 app/controllers/wafflemix/categories_controller.rb
wafflemix-0.0.2 app/controllers/wafflemix/categories_controller.rb
wafflemix-0.0.1 app/controllers/wafflemix/categories_controller.rb