Sha256: da34e7f2fc9d34e4248f08aa0d1b754797fb0fb7764fef3b84408812e15abe87

Contents?: true

Size: 357 Bytes

Versions: 4

Compression:

Stored size: 357 Bytes

Contents

class PostsController < ApplicationController
  before_filter :scope_blog

  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

  private

  def scope_blog
    @blog = Blog.by_slug(params[:blog_slug]).first
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blog_logic-1.4.15 app/controllers/posts_controller.rb
blog_logic-1.4.14 app/controllers/posts_controller.rb
blog_logic-1.4.13 app/controllers/posts_controller.rb
blog_logic-1.4.12 app/controllers/posts_controller.rb