@@ -25,6 +25,7 class Enumeration < ActiveRecord::Base | |||
|
25 | 25 | acts_as_tree :order => 'position ASC' |
|
26 | 26 | |
|
27 | 27 | before_destroy :check_integrity |
|
28 | before_save :check_default | |
|
28 | 29 | |
|
29 | 30 | validates_presence_of :name |
|
30 | 31 | validates_uniqueness_of :name, :scope => [:type, :project_id] |
@@ -51,7 +52,7 class Enumeration < ActiveRecord::Base | |||
|
51 | 52 | nil |
|
52 | 53 | end |
|
53 | 54 | |
|
54 | def before_save | |
|
55 | def check_default | |
|
55 | 56 | if is_default? && is_default_changed? |
|
56 | 57 | Enumeration.update_all("is_default = #{connection.quoted_false}", {:type => type}) |
|
57 | 58 | end |
General Comments 0
You need to be logged in to leave comments.
Login now