Avoid useless database queries.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3077 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
ec4ba23248
commit
c9bfdc009b
app/models
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue