Repository URL to install this package:
|
Version:
0.4.2 ▾
|
module Neoteric
module BlogPostsController
def self.included(base)
base.send(:include, ::Neoteric::ArchiverController)
base.archiving(NeotericBlog.post_class)
base.before_filter :find_recent_posts,
:find_all_tags
end
def index
@title = "Blog"
@blog_posts = NeotericBlog.post_class.published
end
def show
@blog_post = NeotericBlog.post_class.find(params[:id])
if @blog_post.drafted?
render(:template => 'blog_posts/error_404', :status => 404) && return
end
end
def error_404
end
def tagged
@tag = params[:tag]
@title = "Posts tagged '#{@tag}'"
@blog_posts = NeotericBlog.post_class.published.tagged_with(@tag)
render :template => 'blog_posts/index'
end
private
def find_recent_posts
@recent_posts = NeotericBlog.post_class.published.limit(3)
end
def find_all_tags
@tags = NeotericBlog.post_class.published.tag_counts_on(:tags)
end
end
end