In this refactoring I’m using extract method to split up the TimelogController#edit method. Right now it’s handling four separate actions: Display an empty form for a new TimeEntry Save a new TimeEntry Display a form for an existing TimeEntry Save an existing TimeEntry Normally these would be separate RESTful Rails actions; #new, #create, #edit, and …
Redmine Refactor #128: Rename method TimelogController#details to #index
After yesterday’s refactoring of #report I’ve given a lot of thought to what should happen to the #details method. At it’s core, it’s just listing all of the TimeEntries so I think it’s actually an #index method in disguise. To refactor this I used rename method. Before 1 2 3 4 5 6 7 8 …
Redmine Refactor #127: Extract TimelogController#report to new TimeEntryReportsController
Since UsersController was refactored to a resource yesterday, I started on the TimelogController today. TimelogController has a really messy list of actions: Two reporting methods (#report and #details) #edit handles 4 actions for TimeEntries: form for new record, form for an existing record, saving a new record, and updating an existing record. No #index or …
Redmine Refactor #126: Convert UsersController to Resource
Today I decided to go ahead and convert UsersController to a REST resource. There were two non-standard methods left (#edit_membership and #destroy_membership) but I can’t see a clear way to refactor them yet. So I just converted the controller to a resource and added those methods as member routes. Before 1 2 3 4 5 …
A Quick Way to Refresh Your Motivation
Working solo has many advantages but it also comes with many disadvantages. A big disadvantage is you have to always keep yourself motivated, especially on long projects. I set goals. I track my progress. I work as hard as I can to reach those goals. Many times I still fall short. It’s difficult to find …