summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-20 12:57:52 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-20 12:57:52 +0000
commitc9bfdc009baf9aa472b82543fbb3189ff9862b48 (patch)
tree6027386003bf97da3cb7992e1f2848effcb42663 /app
parentec4ba232488302d257877cb2cf0af529026ef319 (diff)
downloadredmine-c9bfdc009baf9aa472b82543fbb3189ff9862b48.tar.gz
redmine-c9bfdc009baf9aa472b82543fbb3189ff9862b48.zip
Avoid useless database queries.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3077 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/custom_value.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/custom_value.rb b/app/models/custom_value.rb
index 4cace724a..39ba59994 100644
--- a/app/models/custom_value.rb
+++ b/app/models/custom_value.rb
@@ -20,7 +20,7 @@ class CustomValue < ActiveRecord::Base
belongs_to :customized, :polymorphic => true
def after_initialize
- if custom_field && new_record? && (customized_type.blank? || (customized && customized.new_record?))
+ if new_record? && custom_field && (customized_type.blank? || (customized && customized.new_record?))
self.value ||= custom_field.default_value
end
end