Repository URL to install this package:
Version:
0.1.1 ▾
|
module Neoteric
module BlogPostsController
def self.included(base)
base.before_filter :find_recent_posts,
:find_archive_months,
:find_all_tags
end
def index
@title = "Blog"
@blog_posts = BLOG_POST_CLASS.published
end
def show
@blog_post = BLOG_POST_CLASS.find(params[:id])
end
def archive
@title = "Posted in #{Date::MONTHNAMES[params[:month].to_i]} #{params[:year]}"
@blog_posts = BLOG_POST_CLASS.by_month(params[:year], params[:month])
render :template => 'blog_posts/index'
end
def tagged
@tag = params[:tag]
@title = "Posts tagged '#{@tag}'"
@blog_posts = BLOG_POST_CLASS.tagged_with(@tag)
render :template => 'blog_posts/index'
end
private
def find_recent_posts
@recent_posts = BLOG_POST_CLASS.limit(3)
end
def find_archive_months
@blog_archive_months = BLOG_POST_CLASS.archive_months
end
def find_all_tags
@tags = BLOG_POST_CLASS.tag_counts_on(:tags)
end
end
end