Class: ActiveBlog::BlogPostsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ActiveBlog::BlogPostsController
- Defined in:
- app/controllers/active_blog/blog_posts_controller.rb
Instance Method Summary collapse
Instance Method Details
#archives ⇒ Object
12 13 14 |
# File 'app/controllers/active_blog/blog_posts_controller.rb', line 12 def archives @blog_posts = BlogPost.all end |
#atom ⇒ Object
35 36 37 38 39 40 |
# File 'app/controllers/active_blog/blog_posts_controller.rb', line 35 def atom @blog_posts = BlogPost.live.order('published_at DESC').limit(10) respond_to do |format| format.xml end end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/active_blog/blog_posts_controller.rb', line 8 def index @blog_posts = BlogPost.live.page(params[:page]) end |
#preview ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/controllers/active_blog/blog_posts_controller.rb', line 26 def preview @blog_post = BlogPost.new(params[:active_blog_blog_post]) @blog_post_partial = render_to_string(:partial => 'active_blog/active_admin/blog_post_show') respond_to do |format| format.js end end |
#show ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/active_blog/blog_posts_controller.rb', line 16 def show @blog_post = BlogPost.live.where(:cached_slug => params[:cached_slug]).first if @blog_post render else # TODO(mc): Should 404 redirect_to active_blog_path, :notice => "No blog post with that URL" end end |