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: ruby
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 …
Noticing more refactorings
Ever since I started my Daily Refactorings I’ve been noticing more and more little things to improve code. The nice thing is that I’ve built up the confidence to tackle the easy ones the moment I see them. Like this one I found while working on a new Redmine plugin for a client. It’s nothing …