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
5
6
7
class WikiController  :post, :only => [:destroy, :protect], :redirect_to => { :action => :index }
 
  # display a page (in editing mode if it doesn't exist)
  def index
    # ...
  end
end

After

1
2
3
4
5
6
7
class WikiController  :post, :only => [:destroy, :protect], :redirect_to => { :action => :show }
 
  # display a page (in editing mode if it doesn't exist)
  def show
    # ...
  end
end

Even though the code change in the controller was very minor, if you look at the full commit you can see all of the views that had to be changed. This will also affect any plugin that is using or linking to wiki pages. I’m confidant that this change will be in the best interest for Redmine though, especially considering that we are going to be adding a REST API for WikiPages for this next release.

Reference commit