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 :action => 'index', :id => @project, :page => nil return end render :action => "special_#{page_title}" end end |
After
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
class WikiController 'export', :id => @project # Compatibility stub while refactoring return else # requested special page doesn't exist, redirect to default page redirect_to :action => 'index', :id => @project, :page => nil return end render :action => "special_#{page_title}" end def date_index load_pages_grouped_by_date_without_content end end |
This let me remove an entire branch from the case statement in #special
. At this point, #special
isn’t doing anything special anymore so it should be safe to remove next. Then I’ll be able to continue refactoring the rest of the WikiController
in order to convert it to a REST resource.