I finally felt comfortable enough to do the final conversion of WikiController to a REST resource. Yesterday’s refactoring of the :id parameter make this a lot easier. 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 …
Tag: redmine
Redmine Refactor #143: Convert WikiController to use :id params
This refactoring is a major change to how Redmine’s WikiController is routed. It’s been using the params[:page] field to track which page in the wiki is being requested but that won’t work with Rails’ resource routing, which uses params[:id]. Since I’ve already refactored Redmine so that params[:project_id] is used instead of params[:id], I am now …
Redmine Refactor #142: Convert WikiController#destroy to use HTTP DELETE
The code in WikiController is still a mess but I need to keep moving on in order to get it converted to a REST resource. Today I decided to convert the #destroy action to use HTTP DELETE. Before 1 2 class WikiController :post, :only => [:destroy, :protect], :redirect_to => { :action => :show } endclass …
Redmine Refactor #141: Rename Method WikiController#page_index
After thinking about the REST API I want for WikiController, I decided that it needs to have an #index action so the user can get a list of the wiki pages. Looking over the actions, I found #page_index was already doing this so I used rename method to convert it over to #index. Before 1 …
Redmine Refactor #140: Extract Method WikiController#edit to #update
Digging into the next method in WikiController, I found that the #edit method is doing way too much. render a form for new wiki page render a form for editing an existing wiki page render a form for rolling back a wiki page creating a new wiki page updating an existing wiki page updating an …