Remove uses of the is_active flag. Keep column in database (for now). The only purpose of this flag was to filter out pools from the pool list in the Add to Pool dialog. This hasn't had much use since autocomplete was added. Most pools didn't set the flag correctly anyway.
29 lines
729 B
Ruby
29 lines
729 B
Ruby
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])
|
|
|
|
if @pool.present? && !@pool.is_deleted?
|
|
@post = Post.find(params[:post_id])
|
|
@pool.add!(@post)
|
|
else
|
|
@error = "That pool does not exist"
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
@pool = Pool.find(params[:pool_id])
|
|
@post = Post.find(params[:post_id])
|
|
@pool.remove!(@post)
|
|
respond_with(@pool, :location => post_path(@post))
|
|
end
|
|
|
|
def all_select
|
|
@pools = Pool.undeleted.order("name").select("id, name")
|
|
@pools.each # hack to force rails to eager load
|
|
@pools
|
|
end
|
|
end
|