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. …
Tag: refactoring
Redmine Refactor #118: Split Edit Method in NewsController
Following up to yesterday’s refactoring of NewsController#new, today I’m using split method again but on #edit. #edit is both rendering the form for editing a news item as well as accepting the form submission and saving it to the database. To work with RESTful Rails, it needs to be split into #edit and #update. Before …
Refactoring Redmine covered on The Ruby Show
Dan Benjamin and Jason Seifer talked about the Refactoring Redmine in the 133rd episode of the Ruby Show. It’s around the 12 minute mark.
Redmine Refactor #117: Split New Method in NewsController
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 …
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 => …