OSDN Git Service

Changed Enumerations to use a Single Table Inheritance
authorEric Davis <edavis@littlestreamsoftware.com>
Sat, 30 May 2009 23:30:36 +0000 (23:30 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Sat, 30 May 2009 23:30:36 +0000 (23:30 +0000)
commit62e58f26b0c6905fc0b2d79ed278ac0e4f55d793
tree6989cbc655e9ffee0db9b7558985cd77d28b0edb
parentfbfb34949677c41734531a552547fb216537999f
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
32 files changed:
app/controllers/documents_controller.rb
app/controllers/enumerations_controller.rb
app/controllers/issues_controller.rb
app/controllers/reports_controller.rb
app/controllers/timelog_controller.rb
app/helpers/issues_helper.rb
app/helpers/timelog_helper.rb
app/models/document.rb
app/models/document_category.rb [new file with mode: 0644]
app/models/enumeration.rb
app/models/issue.rb
app/models/issue_priority.rb [new file with mode: 0644]
app/models/mail_handler.rb
app/models/query.rb
app/models/time_entry.rb
app/models/time_entry_activity.rb [new file with mode: 0644]
app/views/documents/_form.rhtml
app/views/enumerations/_form.rhtml
app/views/enumerations/list.rhtml
app/views/issues/bulk_edit.rhtml
app/views/my/blocks/_issuesassignedtome.rhtml
db/migrate/20090323224724_add_type_to_enumerations.rb [new file with mode: 0644]
db/migrate/20090401221305_update_enumerations_to_sti.rb [new file with mode: 0644]
test/fixtures/enumerations.yml
test/fixtures/issues.yml
test/functional/issues_controller_test.rb
test/integration/issues_test.rb
test/unit/document_category_test.rb [new file with mode: 0644]
test/unit/enumeration_test.rb
test/unit/issue_priority_test.rb [new file with mode: 0644]
test/unit/issue_test.rb
test/unit/time_entry_activity_test.rb [new file with mode: 0644]