This commit is contained in:
Toks
2013-04-20 17:21:00 -04:00
parent 21282b4c99
commit 5e0783b00a
2 changed files with 5 additions and 1 deletions

View File

@@ -579,6 +579,10 @@ class Post < ActiveRecord::Base
pool_string =~ /(?:\A| )pool:#{pool.id}(?:\Z| )/
end
def belongs_to_pool_with_id?(pool_id)
pool_string =~ /(?:\A| )pool:#{pool_id}(?:\Z| )/
end
def add_pool!(pool)
return if belongs_to_pool?(pool)
return if pool.is_deleted?

View File

@@ -146,7 +146,7 @@ class PostPresenter < Presenter
def pool_html(template)
html = ["<ul>"]
if template.params[:pool_id].present?
if template.params[:pool_id].present? && @post.belongs_to_pool_with_id?(template.params[:pool_id])
pool = Pool.where(:id => template.params[:pool_id]).first
return if pool.nil?
html += pool_link_html(template, pool, :include_rel => true)