During yesterday’s refactoring I noticed ProjectsController was using a method called #add instead of #new. By convention Rails (and RESTful Rails) uses the #new method to render the form to create a new record, so I used rename method today to fix that. Before 1 2 3 4 5 6 7 8 9 10 11 …
Tag: rename-method
Daily Refactor #16: Rename method in RolesController
The Refactoring I’m continuing last Friday’s refactor today, but this time renaming the method in RolesController. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # app/controllers/roles_controller.rb class RolesController :post, :only => [ :destroy, :move ], :redirect_to => { :action => :list } def index list …
Daily Refactor #15: Rename method in IssueStatusesController
It’s time to move on from the ReportsController to code that needs to be refactored more. Using Caliper’s Flay Report, it looks like IssueStatusesController, TrackersController, AuthSourcesController, and RolesController all have the exact same index action. 1 2 3 4 def index list render :action => 'list' unless request.xhr? end def index list render :action => …