summaryrefslogtreecommitdiffstats
path: root/app/models/issue.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 7d214de8a..52e21b416 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -46,9 +46,17 @@ class Issue < ActiveRecord::Base
validates_numericality_of :estimated_hours, :allow_nil => true
validates_associated :custom_values, :on => :update
- # set default status for new issues
- def before_validation
- self.status = IssueStatus.default if status.nil?
+ def after_initialize
+ if new_record?
+ # set default values for new records only
+ self.status ||= IssueStatus.default
+ self.priority ||= Enumeration.default('IPRI')
+ end
+ end
+
+ def priority_id=(pid)
+ self.priority = nil
+ write_attribute(:priority_id, pid)
end
def validate