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 …
Tag: refactoring
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 …
Redmine Refactor #139: Rename WikiController#index method to WikiController#show
Today’s refactoring is a pretty simple code change but it has some far reaching impact. While reviewing WikiController‘s refactoring to a REST resource, I noticed that the #index action is being used to show a single WikiPage. So using a simple rename method, I changed this to the standard #show. Before 1 2 3 4 …