Starting on my refactoring of Redmine’s ProjectsController, I used extract class to move the #activity method to a new controller. #activity is used to get a timeline of events on a project, so you can see what’s recently happened. Since it’s not tied to an actual project record, it doesn’t fit on ProjectsController. Before 1 …
Tag: refactoring
Problems when you don’t Refactor Rails: Lower Participation
Another problem unfactored code causes with open source Rails projects, is lower participation. Before getting into that, why do we even care about project participation? Why participation matters Lower participation in open source projects can kill it. Developers care about code quality and will leave if the quality gets too low. Users don’t care about …
Redmine Refactor #100: Convert Issue Routes to REST Resources
For my 100th refactoring of Redmine, I decided to go big. Today I refactored Redmine’s Issue routes from standard Rails routes to actual REST resources. 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 …
Redmine Refactor #99: Extract method from IssuesController#bulk_update
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 }) …
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 …