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 …
Tag: split-method
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 #118: Split Edit Method in NewsController
Following up to yesterday’s refactoring of NewsController#new, today I’m using split method again but on #edit. #edit is both rendering the form for editing a news item as well as accepting the form submission and saving it to the database. To work with RESTful Rails, it needs to be split into #edit and #update. Before …
Redmine Refactor #117: Split New Method in NewsController
Now that IssuesController, ProjectsController, and VersionsController have been refactored to resources, I’m moving on to the NewsController. This controller suffers from the same problem that the other ones did, using the #new and #edit actions for two different purposes. Using split method, I can start to separate these actions and start to convert NewsController to …
Redmine Refactor #115: Split Method in VersionsController
Still focusing on the VersionsController, I need to split another method before I can refactor this controller’s routing. This time #new needs to be split into #new and #create. 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 …