The Refactoring The flay report on Caliper shows that IssuesHelper#show_detail has the most duplicated code in Redmine, specifically inside of a long case statement. The first step I took was to extract a new method from the body of the case statement. Before 1 2 3 4 5 6 7 8 9 10 11 12 …
Tag: redmine
Daily Refactor #30: Move Method into Issue
The Refactoring Today is the day that I finally get to finish the set of refactorings I started back on the 24th. My goal was to start converting the IssuesController into a skinny controller by moving code into the models. Today, I finally was able to cleanly move #issue_update from the controller into the Issue …
Daily Refactor #29: Replace Temp with Query in IssuesController#issue_update
The Refactoring I’m still hammering on #issue_update today. It’s almost to the point where I can move the entire method down into the Issue model but it’s creating too many instance variables that view needs. This refactoring moves one of those variables up into the higher level #edit and #update actions. Before 1 2 3 …
Daily Refactor #28: Decouple flash messages from Attachment#attach_files
The Refactoring After thinking about yesterday’s refactor, I noticed that setting the flash message is going to cause problems for future refactorings since it’s trying to break the MVC constraints. Today I found a way to decouple tracking the failed saves while keeping the flash messages up in the controllers. Before 1 2 3 4 …
Daily Refactor #27: Move Method to the Attachment Model
The Refactoring Today I used move method to refactor part of Redmine that had a TODO comment since 2007. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 # app/controllers/application_controller.rb class ApplicationController 0 a = Attachment.create(:container => obj, :file => file, :description => attachment['description'].to_s.strip, :author => User.current) a.new_record? …