diff --git a/app/models/pool.rb b/app/models/pool.rb index 809367773..a5fcd0ad8 100644 --- a/app/models/pool.rb +++ b/app/models/pool.rb @@ -141,6 +141,7 @@ class Pool < ActiveRecord::Base def add!(post) return if contains?(post.id) + return if is_deleted? update_attributes(:post_ids => add_number_to_string(post.id, post_ids), :post_count => post_count + 1) post.add_pool!(self) @@ -149,6 +150,7 @@ class Pool < ActiveRecord::Base def remove!(post) return unless contains?(post.id) + return if is_deleted? update_attributes(:post_ids => remove_number_from_string(post.id, post_ids), :post_count => post_count - 1) post.remove_pool!(self) diff --git a/app/models/post.rb b/app/models/post.rb index 7fbfba4ab..a00338599 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -553,6 +553,7 @@ class Post < ActiveRecord::Base def add_pool!(pool) return if belongs_to_pool?(pool) + return if pool.is_deleted? self.pool_string = "#{pool_string} pool:#{pool.id}".strip update_column(:pool_string, pool_string) unless new_record? pool.add!(self) @@ -560,6 +561,7 @@ class Post < ActiveRecord::Base def remove_pool!(pool) return unless belongs_to_pool?(pool) + return if pool.is_deleted? self.pool_string = pool_string.gsub(/(?:\A| )pool:#{pool.id}(?:\Z| )/, " ").strip update_column(:pool_string, pool_string) unless new_record? pool.remove!(self)