Redmine Refactor #128: Rename method TimelogController#details to #index

After yesterday’s refactoring of #report I’ve given a lot of thought to what should happen to the #details method. At it’s core, it’s just listing all of the TimeEntries so I think it’s actually an #index method in disguise. To refactor this I used rename method.

Before

1
2
3
4
5
6
7
8
9
class TimelogController  [:edit, :destroy]
  before_filter :find_optional_project, :only => [:details]
 
  verify :method => :post, :only => :destroy, :redirect_to => { :action => :details }
 
  def details
    # ...
  end
end

After

1
2
3
4
5
6
7
8
9
class TimelogController  [:edit, :destroy]
  before_filter :find_optional_project, :only => [:index]
 
  verify :method => :post, :only => :destroy, :redirect_to => { :action => :index }
 
  def index
    # ...
  end
end

Even though this is a simple refactoring, it really helps make TimelogController easier to understand. The #index method will also be used with the REST conversion so it’s a double win.

Reference commit