fixed edge case for pool creation

This commit is contained in:
albert
2012-05-11 15:06:40 -04:00
parent 4b22d0d458
commit 5b557a418a
4 changed files with 5 additions and 4 deletions

View File

@@ -440,7 +440,7 @@ class Post < ActiveRecord::Base
if pool.nil? if pool.nil?
pool = Pool.create(:name => $1, :description => "This pool was automatically generated") pool = Pool.create(:name => $1, :description => "This pool was automatically generated")
end end
add_pool!(pool) add_pool!(pool) if pool
when /^rating:([qse])/i when /^rating:([qse])/i
self.rating = $1.downcase self.rating = $1.downcase

View File

@@ -28,7 +28,7 @@ class TagImplication < ActiveRecord::Base
all.concat(children) all.concat(children)
children = self.class.where(["antecedent_name IN (?)", children]).all.map(&:consequent_name) children = self.class.where(["antecedent_name IN (?)", children]).all.map(&:consequent_name)
end end
end.sort end.sort.uniq
end end
end end

View File

@@ -6,6 +6,7 @@ PoolVersion.find_each do |version|
version.update_column(:post_ids, version.post_ids.scan(/\d+/).in_groups_of(2).map {|x| x.first}.join(" ")) version.update_column(:post_ids, version.post_ids.scan(/\d+/).in_groups_of(2).map {|x| x.first}.join(" "))
end end
TagImplication.destroy_all("antecedent_name = consequent_name")
TagImplication.find_each do |impl| TagImplication.find_each do |impl|
impl.update_descendant_names! impl.update_descendant_names!
end end

View File

@@ -3179,14 +3179,14 @@ CREATE TABLE user_password_reset_nonces (
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone updated_at timestamp without time zone
); );
ALTER TABLE public.user_password_reset_nonces OWNER TO ayi; ALTER TABLE public.user_password_reset_nonces OWNER TO danbooru;
CREATE SEQUENCE user_password_reset_nonces_id_seq CREATE SEQUENCE user_password_reset_nonces_id_seq
START WITH 1 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
CACHE 1; CACHE 1;
ALTER TABLE public.user_password_reset_nonces_id_seq OWNER TO ayi; ALTER TABLE public.user_password_reset_nonces_id_seq OWNER TO danbooru;
ALTER SEQUENCE user_password_reset_nonces_id_seq OWNED BY user_password_reset_nonces.id; ALTER SEQUENCE user_password_reset_nonces_id_seq OWNED BY user_password_reset_nonces.id;
ALTER TABLE user_password_reset_nonces ALTER COLUMN id SET DEFAULT nextval('user_password_reset_nonces_id_seq'::regclass); ALTER TABLE user_password_reset_nonces ALTER COLUMN id SET DEFAULT nextval('user_password_reset_nonces_id_seq'::regclass);
ALTER TABLE ONLY user_password_reset_nonces ALTER TABLE ONLY user_password_reset_nonces