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 …
Tag: ruby
Redmine Refactor #138: Unify Interfaces
Today’s refactoring is a bit different. I’ve noticed a code smell in WikiController that I wanted to fix before I got into it’s other actions. WikiController is working with the WikiPage model pretty intimately. The naming mismatch isn’t the problem though, the problem is with the parameter names that are passed around. :id – the …
Redmine Refactor #137: Remove Method WikiController#special
After several refactorings to WikiController, finally the #special method isn’t pretending to be a traffic cop anymore (routing to other methods). Since it doesn’t have any other purpose now, I’m going to use remove method to toss it into the bit bucket. Before 1 2 3 4 5 6 7 8 9 10 class WikiController …
Redmine Refactor #136: Extract Method date_index in WikiController#special
As a follow up to last Friday’s refactoring of WikiController#special, today I used extract method to remove the date_index method. Before 1 2 3 4 5 6 7 8 9 10 class WikiController 'export', :id => @project # Compatibility stub while refactoring return else # requested special page doesn't exist, redirect to default page redirect_to …
Redmine Refactor #135: Extract Method page_index in WikiController#special
With the #load_pages_grouped_by_date_without_content method extracted in WikiController#special from yesterday, I can now get back to splitting up #special. Before 1 2 3 4 5 6 7 8 9 10 class WikiController 'export', :id => @project # Compatibility stub while refactoring return else # requested special page doesn't exist, redirect to default page redirect_to :action => …