Sha256: f1e36b88c0b1b354cfd84b010563d551c22424bab7406d256d116411e4777ea6

Contents?: true

Size: 632 Bytes

Versions: 1

Compression:

Stored size: 632 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 monologue_current_user
      @post = Monologue::Post.default.where("url = :url", {url: params[:post_url]}).first
    else
      @post = Monologue::Post.published.where("url = :url", {url: params[:post_url]}).first
    end
    if @post.nil?
      not_found
    end
  end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
monologue-0.3.0 app/controllers/monologue/posts_controller.rb