pundit: convert post approvals to pundit.
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
class PostApprovalsController < ApplicationController
|
||||
before_action :approver_only, only: [:create]
|
||||
respond_to :html, :xml, :json, :js
|
||||
|
||||
def create
|
||||
post = Post.find(params[:post_id])
|
||||
@approval = post.approve!
|
||||
@approval = authorize PostApproval.new(user: CurrentUser.user, post_id: params[:post_id])
|
||||
@approval.save
|
||||
respond_with(@approval)
|
||||
end
|
||||
|
||||
def index
|
||||
@post_approvals = PostApproval.paginated_search(params)
|
||||
@post_approvals = authorize PostApproval.paginated_search(params)
|
||||
@post_approvals = @post_approvals.includes(:user, post: :uploader) if request.format.html?
|
||||
|
||||
respond_with(@post_approvals)
|
||||
|
||||
Reference in New Issue
Block a user