Removed after_initialize methods.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8288 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-12-18 14:57:58 +00:00
parent 062fbeae80
commit 9e83ee2ddf
8 changed files with 14 additions and 11 deletions

View File

@ -27,7 +27,8 @@ class AuthSourceLdap < AuthSource
before_validation :strip_ldap_attributes
def after_initialize
def initialize(attributes=nil, *args)
super
self.port = 389 if self.port == 0
end

View File

@ -21,7 +21,8 @@ class CustomValue < ActiveRecord::Base
validate :validate_custom_value
def after_initialize
def initialize(attributes=nil, *args)
super
if new_record? && custom_field && (customized_type.blank? || (customized && customized.new_record?))
self.value ||= custom_field.default_value
end

View File

@ -36,7 +36,8 @@ class Document < ActiveRecord::Base
!user.nil? && user.allowed_to?(:view_documents, project)
end
def after_initialize
def initialize(attributes=nil, *args)
super
if new_record?
self.category ||= DocumentCategory.default
end

View File

@ -124,7 +124,8 @@ class Issue < ActiveRecord::Base
end
end
def after_initialize
def initialize(attributes=nil, *args)
super
if new_record?
# set default values for new records only
self.status ||= IssueStatus.default

View File

@ -57,7 +57,8 @@ class IssueRelation < ActiveRecord::Base
(issue_to.nil? || user.allowed_to?(:manage_issue_relations, issue_to.project)))
end
def after_initialize
def initialize(attributes=nil, *args)
super
if new_record?
if relation_type.blank?
self.relation_type = IssueRelation::TYPE_RELATES

View File

@ -166,10 +166,6 @@ class Query < ActiveRecord::Base
def initialize(attributes=nil, *args)
super attributes
self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} }
end
def after_initialize
# Store the fact that project is nil (used in #editable_by?)
@is_for_all = project.nil?
end

View File

@ -65,7 +65,8 @@ class TimeEntry < ActiveRecord::Base
end
}
def after_initialize
def initialize(attributes=nil, *args)
super
if new_record? && self.activity.nil?
if default_activity = TimeEntryActivity.default
self.activity_id = default_activity.id

View File

@ -55,7 +55,8 @@ class WikiPage < ActiveRecord::Base
# Wiki pages that are protected by default
DEFAULT_PROTECTED_PAGES = %w(sidebar)
def after_initialize
def initialize(attributes=nil, *args)
super
if new_record? && DEFAULT_PROTECTED_PAGES.include?(title.to_s.downcase)
self.protected = true
end