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:
parent
062fbeae80
commit
9e83ee2ddf
|
@ -27,7 +27,8 @@ class AuthSourceLdap < AuthSource
|
||||||
|
|
||||||
before_validation :strip_ldap_attributes
|
before_validation :strip_ldap_attributes
|
||||||
|
|
||||||
def after_initialize
|
def initialize(attributes=nil, *args)
|
||||||
|
super
|
||||||
self.port = 389 if self.port == 0
|
self.port = 389 if self.port == 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@ class CustomValue < ActiveRecord::Base
|
||||||
|
|
||||||
validate :validate_custom_value
|
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?))
|
if new_record? && custom_field && (customized_type.blank? || (customized && customized.new_record?))
|
||||||
self.value ||= custom_field.default_value
|
self.value ||= custom_field.default_value
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,7 +36,8 @@ class Document < ActiveRecord::Base
|
||||||
!user.nil? && user.allowed_to?(:view_documents, project)
|
!user.nil? && user.allowed_to?(:view_documents, project)
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_initialize
|
def initialize(attributes=nil, *args)
|
||||||
|
super
|
||||||
if new_record?
|
if new_record?
|
||||||
self.category ||= DocumentCategory.default
|
self.category ||= DocumentCategory.default
|
||||||
end
|
end
|
||||||
|
|
|
@ -124,7 +124,8 @@ class Issue < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_initialize
|
def initialize(attributes=nil, *args)
|
||||||
|
super
|
||||||
if new_record?
|
if new_record?
|
||||||
# set default values for new records only
|
# set default values for new records only
|
||||||
self.status ||= IssueStatus.default
|
self.status ||= IssueStatus.default
|
||||||
|
|
|
@ -57,7 +57,8 @@ class IssueRelation < ActiveRecord::Base
|
||||||
(issue_to.nil? || user.allowed_to?(:manage_issue_relations, issue_to.project)))
|
(issue_to.nil? || user.allowed_to?(:manage_issue_relations, issue_to.project)))
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_initialize
|
def initialize(attributes=nil, *args)
|
||||||
|
super
|
||||||
if new_record?
|
if new_record?
|
||||||
if relation_type.blank?
|
if relation_type.blank?
|
||||||
self.relation_type = IssueRelation::TYPE_RELATES
|
self.relation_type = IssueRelation::TYPE_RELATES
|
||||||
|
|
|
@ -166,10 +166,6 @@ class Query < ActiveRecord::Base
|
||||||
def initialize(attributes=nil, *args)
|
def initialize(attributes=nil, *args)
|
||||||
super attributes
|
super attributes
|
||||||
self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} }
|
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?
|
@is_for_all = project.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,8 @@ class TimeEntry < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
def after_initialize
|
def initialize(attributes=nil, *args)
|
||||||
|
super
|
||||||
if new_record? && self.activity.nil?
|
if new_record? && self.activity.nil?
|
||||||
if default_activity = TimeEntryActivity.default
|
if default_activity = TimeEntryActivity.default
|
||||||
self.activity_id = default_activity.id
|
self.activity_id = default_activity.id
|
||||||
|
|
|
@ -55,7 +55,8 @@ class WikiPage < ActiveRecord::Base
|
||||||
# Wiki pages that are protected by default
|
# Wiki pages that are protected by default
|
||||||
DEFAULT_PROTECTED_PAGES = %w(sidebar)
|
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)
|
if new_record? && DEFAULT_PROTECTED_PAGES.include?(title.to_s.downcase)
|
||||||
self.protected = true
|
self.protected = true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue