Sha256: 04fe596695c52a516c18efda64e5fdfa190f0b390f4db511f2c70633bbd39087
Contents?: true
Size: 669 Bytes
Versions: 1
Compression:
Stored size: 669 Bytes
Contents
class PostsController < ApplicationController protect_from_forgery before_filter :find_post, :only => [:show] def index @posts = Post.published.recent.with_dates(params[:year], params[:month], params[:day]).paginate(:all, :page=>params[:page], :per_page=>5) end def show if @post @post.view(request.remote_ip, nil) else redirect_to root_path end end def tags @tag = params[:id].gsub(/~dot~/, ".") @posts = Post.tagged_with(@tag).published.recent.paginate(:all, :page=>params[:page], :per_page=>5) render :index end private def find_post @post = Post.find_by_slug(params[:id]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
santey_blog-0.1.2 | app/controllers/posts_controller.rb |