pundit: convert pools to pundit.
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
class PoolElementsController < ApplicationController
|
||||
respond_to :html, :xml, :json, :js
|
||||
before_action :member_only
|
||||
|
||||
def create
|
||||
@pool = Pool.find_by_name(params[:pool_name]) || Pool.find_by_id(params[:pool_id])
|
||||
raise ActiveRecord::RecordNotFound if @pool.nil?
|
||||
authorize(@pool, :update?)
|
||||
|
||||
if @pool.present? && !@pool.is_deleted?
|
||||
@post = Post.find(params[:post_id])
|
||||
@pool.add!(@post)
|
||||
else
|
||||
@error = "That pool does not exist"
|
||||
end
|
||||
@post = Post.find(params[:post_id])
|
||||
@pool.add!(@post)
|
||||
respond_with(@pool)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user