Since I’m all hopped-up on white tea from an early morning meeting, this refactoring is a two in one. The Refactoring I used move method and extract method on the InvoiceController to move the business logic down into the model where it belongs. Before 1 2 3 4 5 6 7 8 9 10 11 …
Tag: move-method
Daily Refactor #73: Move Method to before_filter in InvoiceController
I’m starting to refactor my Redmine Invoice plugin now. This plugin is over two years old now and it’s code has seen better days. The Refactoring The Rails Best Practices gem showed me a quick refactoring to remove some duplication from InvoiceController using a before_filter. Before 1 2 3 4 5 6 7 8 9 …
Daily Refactor #72: Move Method in KanbansController
The Refactoring Today I used move method to clean up a hack job I made a couple of months ago. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 class KanbansController < ApplicationController def sync # Brute force update :) Issue.all.each do |issue| KanbanIssue.update_from_issue(issue) end respond_to do …
Daily Refactor #64: Move Method to QueriesHelper
The Refactoring To continue refactoring Redmine’s IssuesController, I used move method to move a utility method to the QueriesHelper. 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 27 28 29 30 31 32 33 34 35 …
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 …