The Refactoring Today’s refactoring follows up on yesterday’s. Now that I have the #new and #create actions for REST, I can start to remove the duplication I introduced. 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 26 …
Tag: redmine
Daily Refactor #61: Extract Method in IssuesController for REST
Now I’m starting to refactor Redmine’s IssuesController again in order to have it match the standard Rails REST controllers. This time I’m working on the new/create action pair. The Refactoring This refactoring splits the single #new action into the two separate actions. Before 1 2 3 4 5 6 7 8 9 10 11 12 …
Daily Refactor #60: Move Routing Tests – Part Two
The Refactoring This morning I finished the tedious job of moving all of Redmine’s routing tests into the single RoutingTest integration test. I’m only going to show the post refactoring code, the before code looked just like yesterday. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 …
Daily Refactor #59: Move Routing Tests
Next, I’m going to work on refactoring Redmine’s controllers in order to make them match the REST pattern and to take advantage of Rail’s built in REST helpers. In order to do this though, I need to refactor how Redmine’s routes are setup. Since the routes.rb file is over 290 lines long, the first thing …
Daily Refactor #58: Move Method to Query Model
The Refactoring Using move method I was able to move a chunk of duplicated code from the QueriesController into the Query model. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 # app/controllers/queries_controller.rb def new # ... params[:fields].each do |field| @query.add_filter(field, params[:operators][field], params[:values][field]) end if …