3 Star 33 Fork 4

Zoker / Blogine

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
posts_controller.rb 652 Bytes
Copy Edit Web IDE Raw Blame History
Zoker authored 2020-10-28 01:12 . update default posts to 16
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

Comment ( 0 )

Sign in for post a comment

Ruby
1
https://gitee.com/kesin/blogine.git
git@gitee.com:kesin/blogine.git
kesin
blogine
Blogine
master

Search

103611 48b8ff67 1899542 103622 4d02230c 1899542