After thinking about the REST API I want for WikiController, I decided that it needs to have an #index action so the user can get a list of the wiki pages. Looking over the actions, I found #page_index was already doing this so I used rename method to convert it over to #index. Before 1 …
Tag: rename-method
Redmine Refactor #139: Rename WikiController#index method to WikiController#show
Today’s refactoring is a pretty simple code change but it has some far reaching impact. While reviewing WikiController‘s refactoring to a REST resource, I noticed that the #index action is being used to show a single WikiPage. So using a simple rename method, I changed this to the standard #show. Before 1 2 3 4 …
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 #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 …