Redmine’s ProjectsController
is starting to shed actions pretty quickly now. There are two more actions that should belong to a different controller though, #save_activities
and #reset_activities
. I’m starting on #save_activities
today.
These two actions affect a project’s Time Entry Activities, basically the “types” of time that is logged to Redmine (e.g. frontend development, testing, database design). Since they are saved as enumeration records in Redmine, I used extract class move method to create a new controller for the #save_activities
method.
Before
1 2 3 |
class ProjectsController 'projects', :action => 'settings', :tab => 'activities', :id => @project end end |
After
1 2 3 |
class ProjectsController < ApplicationController # Removed save_activities method end |
1 2 3 4 |
class ProjectEnumerationsController 'projects', :action => 'settings', :tab => 'activities', :id => @project end end |
I decided to rename the method to #save
for now. This action is weird because it’s a bulk update/create. (Or in Rails terms, it updates a collection and not a member of a resource) After the next refactoring of #reset_activities
I think I’ll have a better idea of how to update ProjectEnumerationsController
to the REST style, or if it should be made to match REST.