To finish up yesterday’s refactoring of UsersController#add I used rename method to rename #add to #new. Before 1 2 3 4 class UsersController Setting.default_language) @auth_sources = AuthSource.find(:all) end endclass UsersController Setting.default_language) @auth_sources = AuthSource.find(:all) end end After 1 2 3 4 class UsersController Setting.default_language) @auth_sources = AuthSource.find(:all) end endclass UsersController Setting.default_language) @auth_sources = AuthSource.find(:all) end …
Tag: redmine
Redmine Refactor #123: Split #add method in UsersController to #add and #create
The next set of refactorings will be done to the UsersController. There are a few people wanting to add a REST API for Redmine Users, so I want to make the controller is refactored before we start adding new features. UsersController is in pretty good shape, it only has two non-standard methods and two methods …
Redmine Refactor #122: Convert NewsController to REST resource
This refactoring finally finishes converting the NewsController to a REST resource. Since I’ve done a lot refactoring last week, there isn’t much risk left in this conversion. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 …
Redmine Refactor #121: Move Method from NewsController to PreviewsController
Now there is only one non-REST method inside of NewsController left. Today, using move method, I refactored #preview to move it to the dedicated PreviewsController. Before 1 2 3 4 5 6 7 8 9 10 11 class NewsController [:new, :create, :index, :preview] before_filter :find_project_from_association, :except => [:new, :create, :index, :preview] before_filter :find_project, :only => …
Redmine Refactor #120: Move Method from NewsController to CommentsController
Since I created the CommentsController yesterday, today I’m going to move the #destroy_comment method over to it. I also threw in a bit of rename method magic to make it match the RESTful naming conventions. Before 1 2 3 class NewsController 'show', :id => @news end endclass NewsController 'show', :id => @news end end 1 …