The Refactoring Today I used the inline method refactoring to make the ReportsController even more concise by removing all of the utility methods. 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 28 29 30 31 …
Tag: ruby
Daily Refactor #12: Extract rendering in the case statement
It seems like every time I try to apply a big refactoring, there are parts that are missed. I tried to refactor the entire case statement in issue_report_details into a common data structure and a lookup method. But it ended up being more complex than the case statement was so I threw it away and …
Daily Refactor #11: Extract action in ReportsController
I’m back up in the ReportsController now, getting ready to tackle some more of the duplication. The Refactoring Before 1 2 3 4 5 # config/routes.rb map.with_options :controller => 'reports', :action => 'issue_report', :conditions => {:method => :get} do |reports| reports.connect 'projects/:id/issues/report' reports.connect 'projects/:id/issues/report/:detail' end# config/routes.rb map.with_options :controller => 'reports', :action => 'issue_report', :conditions => …
Daily Refactor #10: Pull up the #find_project method to the ApplicationController
Back up in the ReportsController, there is still some duplication that needs to be resolved. There are nine methods: 1 controller action (issue_report) 1 private before_filter method (find_project) 7 private utility methods The controller action is ripe for a few refactorings but I wanted to start with the find_project for personal reasons. I used the …
Why I don’t use HAML or SASS
Seeing as the ERB vs HAML decision has now reached the armed conflict status, I figured that I would voice my opinions before it becomes yet another holy war. HAML, SASS, and ERB are all tools. From what I’ve seen, they are all very good quality and they all have their shortcomings. You can write …