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