Class: PostsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/posts_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#render_404

Instance Method Details

#showObject



4
5
6
7
8
# File 'app/controllers/posts_controller.rb', line 4

def show
  posts = Rails.env.test? || can?(:manage, Post.first) ? @blog.posts : @blog.posts.published
  @post = posts.by_slug(params[:post_slug]).first
  render_404 if @post.nil?
end