9 Star 61 Fork 10

Zoker / Blogine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
posts_controller.rb 652 Bytes
一键复制 编辑 原始数据 按行查看 历史
Zoker 提交于 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
Ruby
1
https://gitee.com/kesin/blogine.git
git@gitee.com:kesin/blogine.git
kesin
blogine
Blogine
master

搜索帮助