During yesterday’s refactoring I noticed ProjectsController was using a method called #add instead of #new. By convention Rails (and RESTful Rails) uses the #new method to render the form to create a new record, so I used rename method today to fix that. Before 1 2 3 4 5 6 7 8 9 10 11 …
Tag: ruby
Redmine Refactor #107: Extract method #create from ProjectsController#add
I decided to start splitting the dual method actions in the ProjectsController (dual method: takes GET and POST requests to perform two separate actions). I wanted to merge some of the extra actions like #archive into these methods first but I think it will be easier once the dual methods are split up. I might …
Redmine Refactor #106: Move method from ProjectsController#reset_activities to ProjectEnumerationsController#destroy
In today’s refactoring, I finished up refactoring ProjectsController to ProjectEnumerationsController. Using move method I moved #reset_activities to ProjectEnumerationsController and renamed it to #destroy. Before 1 2 3 class ProjectsController 'projects', :action => 'settings', :tab => 'activities', :id => @project end endclass ProjectsController 'projects', :action => 'settings', :tab => 'activities', :id => @project end end 1 …
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 #104: Move method from ProjectsController#add_file to FilesController#new
Since I created a new FilesController yesterday, I can now move another method over to it from the ProjectsController. ProjectsController#add_file is used for two things: To show the form that’s used to upload a new file To receive a new file upload Since both of these are basic descriptions of what I’d expect a File …