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 …
Tag: ruby
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 …
Guest Post on RailsInside.com about Refactoring Rails using Flog
My second guest post to RailsInside.com, How To Score Your Rails App’s Complexity Before Refactoring was just posted. It includes how to use flog to find the complex code in your application.
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 …