Today I decided to go ahead and convert UsersController to a REST resource. There were two non-standard methods left (#edit_membership and #destroy_membership) but I can’t see a clear way to refactor them yet. So I just converted the controller to a resource and added those methods as member routes. Before 1 2 3 4 5 …
Tag: ruby
Redmine Refactor #125: Split UsersController#edit into #edit and #update
Working my way through the UsersController class, the next method that needs to be refactored is #edit. This method has the common problem of both: rendering the edit form also accepting the POST data from the form To fit the REST pattern, this needs to be split into separate #edit and #update methods. Before 1 …
Redmine Refactor #124: Rename Method UsersController#add
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 …
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 …