@@ -5,12 +5,12 | |||
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 |
# |
|
|
8 | # | |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 |
# |
|
|
13 | # | |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
@@ -19,15 +19,15 class IssueCategory < ActiveRecord::Base | |||
|
19 | 19 | belongs_to :project |
|
20 | 20 | belongs_to :assigned_to, :class_name => 'Principal', :foreign_key => 'assigned_to_id' |
|
21 | 21 | has_many :issues, :foreign_key => 'category_id', :dependent => :nullify |
|
22 | ||
|
22 | ||
|
23 | 23 | validates_presence_of :name |
|
24 | 24 | validates_uniqueness_of :name, :scope => [:project_id] |
|
25 | 25 | validates_length_of :name, :maximum => 30 |
|
26 | ||
|
26 | ||
|
27 | 27 | named_scope :named, lambda {|arg| { :conditions => ["LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip]}} |
|
28 | ||
|
28 | ||
|
29 | 29 | alias :destroy_without_reassign :destroy |
|
30 | ||
|
30 | ||
|
31 | 31 | # Destroy the category |
|
32 | 32 | # If a category is specified, issues are reassigned to this category |
|
33 | 33 | def destroy(reassign_to = nil) |
@@ -36,10 +36,10 class IssueCategory < ActiveRecord::Base | |||
|
36 | 36 | end |
|
37 | 37 | destroy_without_reassign |
|
38 | 38 | end |
|
39 | ||
|
39 | ||
|
40 | 40 | def <=>(category) |
|
41 | 41 | name <=> category.name |
|
42 | 42 | end |
|
43 | ||
|
43 | ||
|
44 | 44 | def to_s; name end |
|
45 | 45 | end |
General Comments 0
You need to be logged in to leave comments.
Login now