fixes for upgrade schema script

This commit is contained in:
albert
2011-11-06 10:12:23 -05:00
parent c478eb33b6
commit 5158d1b274
15 changed files with 3756 additions and 274 deletions

View File

@@ -292,7 +292,7 @@ class Post < ActiveRecord::Base
raise PostFlag::Error.new("Post is locked and cannot be flagged")
end
flag = flags.create(:reason => reason)
flag = flags.create(:reason => reason, :is_resolved => false)
if flag.errors.any?
raise PostFlag::Error.new(flag.errors.full_messages.join("; "))

View File

@@ -343,7 +343,7 @@ class Tag < ActiveRecord::Base
end
def should_update_related?
related_tags.blank? || related_tags_updated_at < related_cache_expiry.hours.ago
related_tags.blank? || related_tags_updated_at.blank? || related_tags_updated_at < related_cache_expiry.hours.ago
end
def related_tag_array

View File

@@ -26,7 +26,6 @@ class User < ActiveRecord::Base
validates_confirmation_of :password
validates_presence_of :email, :if => lambda {|rec| rec.new_record? && Danbooru.config.enable_email_verification?}
validate :validate_ip_addr_is_not_banned, :on => :create
before_validation :convert_blank_email_to_null
before_validation :normalize_blacklisted_tags
before_create :encrypt_password_on_create
before_update :encrypt_password_on_update
@@ -303,12 +302,6 @@ class User < ActiveRecord::Base
raise User::Error.new("Verification key does not match")
end
end
def convert_blank_email_to_null
if email.blank?
self.email = nil
end
end
end
module BlacklistMethods