The Refactoring After a two hour Developer Meeting for Redmine this morning, I’m too drained to tackle the entire refactoring for #find_optional_project. I did use pull up method to remove the duplication in the GanttsController and IssuesController though. Before 1 2 3 4 5 6 7 # app/controllers/issues_controller.rb class IssuesController params[:controller], :action => params[:action]}, @project, …
Tag: redmine
Daily Refactor #66: Pull Up Method to ApplicationController
The Refactoring Today I cleaned up one of the duplications from yesterday’s refactoring, using pull up method. Before 1 2 3 4 5 6 7 8 9 # app/controllers/issues_controller.rb class IssuesController < ApplicationController def query_statement_invalid(exception) logger.error "Query::StatementInvalid: #{exception.message}" if logger session.delete(:query) sort_clear render_error "An error occurred while executing the query and has been logged. Please …
Daily Refactor #65: Extract Gantt to a new controller
The Refactoring Today I finally tackled a larger refactoring that I’ve been wanting to do for awhile now. Redmine’s IssuesController has accumulated a lot of extra actions over the years, one of which is an action that renders a Gantt chart. This has never made sense to me, since the Gantt chart collects a bunch …
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 #63: Extract Method to before_filter in IssuesController
The Refactoring Mark Thomas pointed out some odd code in Redmine’s IssuesController#build_new_issue_from_params, specifically that it’s doing some error checking in the middle of a method body. 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 # …