Sha256: f51320155adcc21f8003ac6cb32df20519b3f72ce205765322c06188d2d77b52

Contents?: true

Size: 400 Bytes

Versions: 10

Compression:

Stored size: 400 Bytes

Contents

class PostsController < ApplicationController
  def index
    @posts = Post.all
    @recent_comments = Comment.with_state(:published)
                       .where(commentable_state: [:published])
                       .recent.page(params[:page])
  end

  def show
    @post     = Post.find params[:id]
    @comments = @post.comments.with_state([:draft, :published]).nested_set
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
fuck_comments-2.3.4 spec/dummy_app/app/controllers/posts_controller.rb
the_comments_ruby-2.3.4 spec/dummy_app/app/controllers/posts_controller.rb
the_comments_ruby-2.3.3 spec/dummy_app/app/controllers/posts_controller.rb
the_comments-2.3.1 spec/dummy_app/app/controllers/posts_controller.rb
the_comments-2.2.2 spec/dummy_app/app/controllers/posts_controller.rb
the_comments-2.2.1 spec/dummy_app/app/controllers/posts_controller.rb
the_comments-2.2.0 spec/dummy_app/app/controllers/posts_controller.rb
the_comments-2.1.0 spec/dummy_app/app/controllers/posts_controller.rb
the_comments-2.0.1 spec/dummy_app/app/controllers/posts_controller.rb
the_comments-2.0.0 spec/dummy_app/app/controllers/posts_controller.rb