Since UsersController was refactored to a resource yesterday, I started on the TimelogController today. TimelogController has a really messy list of actions: Two reporting methods (#report and #details) #edit handles 4 actions for TimeEntries: form for new record, form for an existing record, saving a new record, and updating an existing record. No #index or …
Tag: extract-class
Redmine Refactor #119: Extract Class from NewsController
Now that I’ve refactored many of the standard REST methods in NewsController, I need to work on the non-standard ones. There are two which really bother me, #add_comment and #destroy_comment. If your controllers have actions that include the name of a different model, there is a good chance that a extract class needs to happen. …
Redmine Refactor #105: Move method from ProjectsController#save_activities to ProjectEnumerationsController#save
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 …
Redmine Refactor #103: Move method from ProjectsController#list_files to FilesController#index
Looking through Redmine’s ProjectsController, I found a few actions that were being used to manage project files. These files are separate resources on a project so using move method and extract class I created a new controller, FilesController. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 class ProjectsController …
Redmine Refactor #101: Extract activity from ProjectsController to a new controller
Starting on my refactoring of Redmine’s ProjectsController, I used extract class to move the #activity method to a new controller. #activity is used to get a timeline of events on a project, so you can see what’s recently happened. Since it’s not tied to an actual project record, it doesn’t fit on ProjectsController. Before 1 …