Now that I refactored Redmine and split the #bulk_edit method, I’m ready to start to refactor the #bulk_update method. Starting with the block of code that’s setting attributes, I used extract method to pull it out into a utility method. Before 1 2 3 4 5 6 7 class IssuesController params, :issue => issue }) …
Tag: ruby
Redmine Refactor #98: Extract method from IssuesController#bulk_edit
After thinking about how IssuesController#bulk_edit works, I decided to leave it in IssuesController. It doesn’t match Rail’s REST conventions but it does match the REST principles for resource representations. IssuesController returns representations of issue collections and issue objects. Since #bulk_edit works on an issue collection, keeping it in the IssuesController makes sense. There still is …
Problems when you don’t Refactor Rails: Lowered morale
I last talked about how wild estimates affects a team with unfactored code. Now I want to look at another impact on the team that is even more dangerous. Lowered morale In order to produce a great application, every team needs to work as a team. They should want to help each other and go …
Redmine Refactor #97: Move method from IssuesController to JournalsController
Starting a fresh week, it’s time to finish up refactoring IssuesController to remove the last of the extra actions. Using move method I was able to move the #changes method to the JournalsController. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 class IssuesController …
Redmine Refactor #96: Merge Method in IssuesController
To wrap up this week’s refactoring of IssuesController, I used merge method to merge the #update_form action into #new. The #update_form method is an Ajax endpoint that is used to refresh an issue form’s fields. For example, when an issue form changes from Bug to Feature it needs to load the fields for a Feature. …