Better error when trying to add to nonexistent pool

fixes #2546
This commit is contained in:
Toks
2015-11-03 23:31:19 -05:00
parent 6514265ca7
commit bf182cb652
3 changed files with 9 additions and 4 deletions

View File

@@ -5,13 +5,13 @@ class PoolElementsController < ApplicationController
def create
@pool = Pool.find_by_name(params[:pool_name]) || Pool.find_by_id(params[:pool_id])
if @pool.present?
if @pool.present? && !@pool.is_deleted?
@post = Post.find(params[:post_id])
@pool.add!(@post)
append_pool_to_session(@pool)
else
@error = "That pool does not exist"
end
respond_with(@pool, :location => post_path(@post))
end
def destroy