Fixes #2042, fix specs

This commit is contained in:
r888888888
2013-12-03 17:19:56 -08:00
parent d270f9d98b
commit b618322ac1
5 changed files with 25 additions and 38 deletions

View File

@@ -125,8 +125,12 @@ class Pool < ActiveRecord::Base
name.gsub(/\s+/, "_")
end
def self.normalize_post_ids(post_ids)
post_ids.scan(/\d+/).uniq.join(" ")
def self.normalize_post_ids(post_ids, unique)
hoge = post_ids.scan(/\d+/)
if unique
hoge = hoge.uniq
end
hoge.join(" ")
end
def self.find_by_name(name)
@@ -139,6 +143,14 @@ class Pool < ActiveRecord::Base
end
end
def is_series?
category == "series"
end
def is_collection?
category == "collection"
end
def initialize_is_active
self.is_deleted = false if is_deleted.nil?
self.is_active = true if is_active.nil?
@@ -165,7 +177,7 @@ class Pool < ActiveRecord::Base
end
def normalize_post_ids
self.post_ids = self.class.normalize_post_ids(post_ids)
self.post_ids = self.class.normalize_post_ids(post_ids, is_collection?)
end
def revert_to!(version)