The Refactoring Since I refactored Invoice#outstanding yesterday, I can now build on that to refactor Invoice#fully_paid?. Before 1 2 3 class Invoice = self.amount end endclass Invoice = self.amount end end After 1 2 3 4 5 class Invoice < ActiveRecord::Base def fully_paid? outstanding <= 0 end endclass Invoice < ActiveRecord::Base def fully_paid? outstanding <= …
Tag: replace-temp-with-query
Daily Refactor #29: Replace Temp with Query in IssuesController#issue_update
The Refactoring I’m still hammering on #issue_update today. It’s almost to the point where I can move the entire method down into the Issue model but it’s creating too many instance variables that view needs. This refactoring moves one of those variables up into the higher level #edit and #update actions. Before 1 2 3 …