Now that IssuesController, ProjectsController, and VersionsController have been refactored to resources, I’m moving on to the NewsController. This controller suffers from the same problem that the other ones did, using the #new and #edit actions for two different purposes. Using split method, I can start to separate these actions and start to convert NewsController to …
Tag: extract-method
Redmine Refactor #115: Split Method in VersionsController
Still focusing on the VersionsController, I need to split another method before I can refactor this controller’s routing. This time #new needs to be split into #new and #create. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 …
Redmine Refactor #114: Split Method in VersionsController
Just like in FilesController, I need to split a few methods in VersionsController before I can nest it under the projects resource. Before 1 2 3 4 5 class VersionsController 'projects', :action => 'settings', :tab => 'versions', :id => @project end end end endclass VersionsController 'projects', :action => 'settings', :tab => 'versions', :id => @project …
Redmine Refactor #112: Split Method in FilesController
The next step to refactor Redmine’s ProjectsController is to start converting all of it’s related resources into RESTful controllers. Looking at config/routes.rb, it looks like FilesController is using three custom routes that hang off of ‘/projects/’ and the #new action is being used for both HTTP GET and HTTP POST. So I’ll use split method …
Redmine Refactor #109: Extract method ProjectsController#edit to #update
Using extract method on the ProjectsController, I split the #edit method into #edit and #update. This is starting to become a standard refactoring for me now while I convert everything over to RESTful Rails. I’m even thinking about naming this refactoring “split method” or “split action”. Before 1 2 3 4 5 6 7 8 …