This is the final refactoring I want to do on IssueMovesController for now. Using pull up method, I moved the last duplicated method from IssueMovesController to ApplicationController. Before 1 2 3 4 5 6 class IssuesController unsaved_issue_ids.size, :total => issues.size, :ids => '#' + unsaved_issue_ids.join(', #')) end end endclass IssuesController unsaved_issue_ids.size, :total => issues.size, :ids …
Tag: pull-up-method
Redmine Refactor #90: Pull Up Method to ApplicationController
Now, in order to finish up IssueMovesController, I need to refactor the duplicated methods that I copied from IssuesController. Pull up method is a great refactoring to use in this case. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 class IssuesController < ApplicationController # Filter …
Daily Refactor #67: Pull Up Method to ApplicationController
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, …
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 #36: Extract Method to the Member model
The Refactoring Going back to the flay report, I used a combination of extract method and move method to move some duplication from a Controller to a shared Model method. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 # app/controller/users_controller.rb class UsersController @user) @membership.attributes = params[:membership] @membership.save …