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 => …
Tag: ruby
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 …
Redmine Refactor #119: Extract Class from NewsController
Now that I’ve refactored many of the standard REST methods in NewsController, I need to work on the non-standard ones. There are two which really bother me, #add_comment and #destroy_comment. If your controllers have actions that include the name of a different model, there is a good chance that a extract class needs to happen. …
Refactoring Redmine covered on The Ruby Show
Dan Benjamin and Jason Seifer talked about the Refactoring Redmine in the 133rd episode of the Ruby Show. It’s around the 12 minute mark.
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 …