I’m still working on refactoring that case statement in WikiController#special but before I can extract the next actions (page_index,date_index), I need to refactor some of it’s inner logic. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 class WikiController "#{WikiPage.table_name}.*, #{WikiContent.table_name}.updated_on", :joins => "LEFT JOIN #{WikiContent.table_name} ON …
Tag: redmine
Redmine Refactor #133: Extract Method in WikiController#special
I started trying to refactor the routes.rb for Redmine in order to nest the resources and remove some duplication. Unfortunately, I kept running into trouble and had to scrap that plan. So instead I decided to continue on with my controller refactoring and try to improve things there first. Using the wc technique I wrote …
Redmine Refactor #132: Convert Timelogs to REST Resource
Now that TimelogController has most of the REST actions it needs, I’m able to convert it to a REST resource. 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 30 31 32 # config/routes.rb …
Redmine Refactor #131: Extract Method TimelogController#edit to TimelogController#update
Finally, today I was able to refactor enough of TimelogController in order to start removing the extra code from #edit. Using extract method I pulled out the #update method that will perform the actual database saves for a TimeEntry. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 …
Redmine Refactor #130: Extract Method TimelogController#edit to TimelogController#new
Yesterday’s refactoring of TimelogController#edit took care of it’s first action. Now I need to use extract method again to pull out the “save new TimeEntry” action (#create). Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 class TimelogController [:new, :edit, :destroy] def edit (render_403; return) …