Method: Admin::PostsController#approve

Defined in:
app/controllers/admin/posts_controller.rb

#approveObject



103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'app/controllers/admin/posts_controller.rb', line 103

def approve
  @post = Effective::Post.find(params[:id])
  @page_title = 'Approve Post'

  authorize_effective_posts!

  if @post.update_attributes(draft: false)
    flash[:success] = 'Successfully approved post.  It is now displayed on the website.'
  else
    flash[:danger] = "Unable to approve post: #{@post.errors.full_messages.join(', ')}"
  end

  redirect_to(:back) rescue redirect_to(effective_posts.admin_posts_path)
end