Fetch the repository succeeded.
class PostsController < ApplicationController
before_action :post, only: [:show]
before_action :authenticate_read_post, only: [:show]
def index
@posts = Post.releases
@posts = @posts.unconcealed if current_user.blank?
@posts = @posts.sorted_by_created.includes(:tags, :column).page(params[:page]).per(16)
end
def show
@comments = @post.comments.unconcealed.includes(:children)
end
private
def post
@post = Post.find_by_ident(params[:id])
return render_404 if @post.blank?
end
def authenticate_read_post
return render_404 unless @post.public? || (@post.private? && current_user.present?)
end
end
Sign in for post a comment
Comment ( 0 )