Changed Enumerations to use a Single Table Inheritance

* Added migrations to change Enumerations to an STI relationship
* Added TimeEntryActivity model (STI)
* Added DocumentCategory model (STI)
* Added IssuePriority model (STI)
* Added Enumeration#get_subclasses to get a list of the subclasses of Enumeration
* Changed Enumeration to use the STI type field instead of the opt field
* Changed Enumeration#opt to return the old opt values but with a deprecation warning.
* Removed Enumeration::OPTIONS
* Removed the dynamic named_scopes in favor of specific named_scopes.  Kept for
  compatibility reasons.
* Added Enumeration#default so each subclass can easily find it's default record.
* Fixed Enumeration#default to use the STI scoping with a fake default scope for finding Enumeration's default.
* Added a 'all' named scope for getting all records in order by position.
* Added Deprecation warnings to the old named_scopes in Enumerations.
* Moved various methods off of Enumeration and onto the concrete classes
* Changed the EnumerationsController to use types
* Updated the Enumeration list template
* Added has_many relationships to the Enumeration STI classes.
* Fixes for tests.

  #3007

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2777 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis
2009-05-30 23:30:36 +00:00
parent fbfb349496
commit 62e58f26b0
32 changed files with 394 additions and 89 deletions
+22 -1
View File
@@ -3,46 +3,67 @@ enumerations_001:
name: Uncategorized
id: 1
opt: DCAT
type: DocumentCategory
enumerations_002:
name: User documentation
id: 2
opt: DCAT
type: DocumentCategory
enumerations_003:
name: Technical documentation
id: 3
opt: DCAT
type: DocumentCategory
enumerations_004:
name: Low
id: 4
opt: IPRI
type: IssuePriority
enumerations_005:
name: Normal
id: 5
opt: IPRI
type: IssuePriority
is_default: true
enumerations_006:
name: High
id: 6
opt: IPRI
type: IssuePriority
enumerations_007:
name: Urgent
id: 7
opt: IPRI
type: IssuePriority
enumerations_008:
name: Immediate
id: 8
opt: IPRI
type: IssuePriority
enumerations_009:
name: Design
id: 9
opt: ACTI
type: TimeEntryActivity
enumerations_010:
name: Development
id: 10
opt: ACTI
type: TimeEntryActivity
is_default: true
enumerations_011:
name: QA
id: 11
opt: ACTI
type: TimeEntryActivity
enumerations_012:
name: Default Enumeration
id: 12
opt: ''
type: Enumeration
is_default: true
enumerations_013:
name: Another Enumeration
id: 13
opt: ''
type: Enumeration
+2 -2
View File
@@ -95,7 +95,7 @@ issues_007:
created_on: <%= 10.days.ago.to_date.to_s(:db) %>
project_id: 1
updated_on: <%= 10.days.ago.to_date.to_s(:db) %>
priority_id: 3
priority_id: 5
subject: Issue due today
id: 7
fixed_version_id:
@@ -112,7 +112,7 @@ issues_008:
created_on: <%= 10.days.ago.to_date.to_s(:db) %>
project_id: 1
updated_on: <%= 10.days.ago.to_date.to_s(:db) %>
priority_id: 3
priority_id: 5
subject: Closed issue
id: 8
fixed_version_id: