Sha256: c8de0887f464e0ccd752adf9b3d8b9c1cddb7b613fdfc1eb9dc215c7f094c274

Contents?: true

Size: 730 Bytes

Versions: 2

Compression:

Stored size: 730 Bytes

Contents

class Monologue::PostsController < Monologue::ApplicationController
  caches_page :index, :show, :feed , :if => Proc.new { monologue_page_cache_enabled? }

  def index
    @page = params[:page].nil? ? 1 : params[:page]
    @posts = Monologue::Post.published.page(@page)
  end

  def show
    if current_user
      post = Monologue::Post.default.where("monologue_posts_revisions.url = :url", {:url => params[:post_url]}).first
    else
      post = Monologue::Post.published.where("monologue_posts_revisions.url = :url", {:url => params[:post_url]}).first
    end
    if post.nil?
      not_found
      return
    end
    @revision = post.active_revision
  end

  def feed
    @posts = Monologue::Post.published.limit(25)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
monologue-0.2.0 app/controllers/monologue/posts_controller.rb
monologue-0.2.0.beta3 app/controllers/monologue/posts_controller.rb