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: ruby
Redmine Refactor #116: Convert VersionsController to resource
Now that I’ve split the actions in VersionsController, it’s ready to be refactoring to a full RESTful resource. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 # config/routes.rb map.resources :projects, :member => { :copy => [:get, :post], :settings => …
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 #113: Convert FilesController to resource
With yesterday’s split method on FilesController complete, I’m now ready to convert FilesController to become a full RESTful resource under projects. 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 # config/routes.rb map.resources :projects, :member => { :copy => …