The next refactoring I performed on Redmine’s ProjectsController was to move the #roadmap method to VersionsController. The #roadmap is used to list all Versions on a project. Since that fits Rails’ RESTful conventions for #index, I used move method to move it to the VersionsController. Before 1 2 3 4 5 6 7 8 9 …
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 #101: Extract activity from ProjectsController to a new controller
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 …
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 }) …