##// END OF EJS Templates
Removed after_initialize methods....
Jean-Philippe Lang -
r8168:9e83ee2ddf3c
parent child
Show More
@@ -27,7 +27,8 class AuthSourceLdap < AuthSource
27 27
28 28 before_validation :strip_ldap_attributes
29 29
30 def after_initialize
30 def initialize(attributes=nil, *args)
31 super
31 32 self.port = 389 if self.port == 0
32 33 end
33 34
@@ -21,7 +21,8 class CustomValue < ActiveRecord::Base
21 21
22 22 validate :validate_custom_value
23 23
24 def after_initialize
24 def initialize(attributes=nil, *args)
25 super
25 26 if new_record? && custom_field && (customized_type.blank? || (customized && customized.new_record?))
26 27 self.value ||= custom_field.default_value
27 28 end
@@ -36,7 +36,8 class Document < ActiveRecord::Base
36 36 !user.nil? && user.allowed_to?(:view_documents, project)
37 37 end
38 38
39 def after_initialize
39 def initialize(attributes=nil, *args)
40 super
40 41 if new_record?
41 42 self.category ||= DocumentCategory.default
42 43 end
@@ -124,7 +124,8 class Issue < ActiveRecord::Base
124 124 end
125 125 end
126 126
127 def after_initialize
127 def initialize(attributes=nil, *args)
128 super
128 129 if new_record?
129 130 # set default values for new records only
130 131 self.status ||= IssueStatus.default
@@ -57,7 +57,8 class IssueRelation < ActiveRecord::Base
57 57 (issue_to.nil? || user.allowed_to?(:manage_issue_relations, issue_to.project)))
58 58 end
59 59
60 def after_initialize
60 def initialize(attributes=nil, *args)
61 super
61 62 if new_record?
62 63 if relation_type.blank?
63 64 self.relation_type = IssueRelation::TYPE_RELATES
@@ -166,10 +166,6 class Query < ActiveRecord::Base
166 166 def initialize(attributes=nil, *args)
167 167 super attributes
168 168 self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} }
169 end
170
171 def after_initialize
172 # Store the fact that project is nil (used in #editable_by?)
173 169 @is_for_all = project.nil?
174 170 end
175 171
@@ -65,7 +65,8 class TimeEntry < ActiveRecord::Base
65 65 end
66 66 }
67 67
68 def after_initialize
68 def initialize(attributes=nil, *args)
69 super
69 70 if new_record? && self.activity.nil?
70 71 if default_activity = TimeEntryActivity.default
71 72 self.activity_id = default_activity.id
@@ -55,7 +55,8 class WikiPage < ActiveRecord::Base
55 55 # Wiki pages that are protected by default
56 56 DEFAULT_PROTECTED_PAGES = %w(sidebar)
57 57
58 def after_initialize
58 def initialize(attributes=nil, *args)
59 super
59 60 if new_record? && DEFAULT_PROTECTED_PAGES.include?(title.to_s.downcase)
60 61 self.protected = true
61 62 end
General Comments 0
You need to be logged in to leave comments. Login now