Sha256: 7c044a6f3b346ce0ae455baa12a3e9db3f76b85d9a6774686276f28a02afa6dc

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 Bytes

Contents

module SimpleForum
  class ForumsController < ApplicationController
    respond_to :html

    before_filter :find_forum, :except => [:index]

    def index
      @categories = SimpleForum::Category.default_order.includes({:forums => [{:recent_post => [:user, :topic]}, :moderators]})

      respond_to :html
    end

    def show
      @forum.bang_recent_activity(authenticated_user)

      scope = @forum.topics.includes([:user, {:recent_post => :user}])
      @topics = scope.respond_to?(:paginate) ? scope.paginate(:page => params[:page], :per_page => params[:per_page]) : scope.all

      respond_to :html
    end

    private

    def find_forum
      @forum = SimpleForum::Forum.find params[:id]
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_forum-0.0.1 app/controllers/simple_forum/forums_controller.rb