fixes to tag search page

This commit is contained in:
albert
2013-02-17 15:10:58 -05:00
parent 8554cdcc96
commit b4e338bf0f
5 changed files with 14 additions and 8 deletions

View File

@@ -3,18 +3,24 @@ class PoolElementsController < ApplicationController
before_filter :member_only
def create
@pool = Pool.find_by_name(params[:pool_name]) || Pool.find_by_id(params[:pool_id]) || Pool.create(:name => params[:pool_name], :description => "This pool was automatically generated")
@pool = Pool.find_by_name(params[:pool_name]) || Pool.find_by_id(params[:pool_id])
if @pool.nil?
return
end
@post = Post.find(params[:post_id])
@pool.add!(@post)
append_pool_to_session(@pool)
respond_with(@pool, :location => pool_path(@pool))
respond_with(@pool, :location => post_path(@post))
end
def destroy
@pool = Pool.find(params[:pool_id])
@post = Post.find(params[:post_id])
@pool.remove!(@post)
respond_with(@pool, :location => pool_path(@pool))
respond_with(@pool, :location => post_path(@post))
end
private