Tag: refactoring

Refactoring Rails Product

I’m building a compilation of my daily refactorings into a new product. It will include additional content that isn’t available here but I wanted to get some ideas about what you’d like to see added. If you answer the short survey below, I’ll give you a free copy of the product when it’s ready. I’ll …

Read more

Pausing Daily Refactors

After almost four months of daily refactors, I’ve decided to pause them. They have been very successful and helped me overcome a lot of the fears I’ve had with programming. I just feel that they have lost some of their value now and I want to move on to another interesting idea for self training. …

Read more

Daily Refactor #81: Move last_invoice_number to Model

The Refactoring Today I used move method on the InvoiceController to move the #last_invoice_number to the Invoice model Before 1 2 3 4 5 6 7 8 class InvoiceController 'id DESC') unless last_invoice.nil? last_invoice.invoice_number else '-' end end endclass InvoiceController 'id DESC') unless last_invoice.nil? last_invoice.invoice_number else '-' end end end 1 2 3 class Invoice …

Read more

Daily Refactor #80: Convert PaymentsController to REST Controller

The Refactoring Following up on yesterday’s refactoring, today I converted the PaymentsController to a REST controller. Before 1 2 3 4 5 6 7 8 9 10 11 # config/routes.rb ActionController::Routing::Routes.draw do |map| map.resources(:invoice, :collection => { :autocreate => :get, :autofill => :get }, :member => { :outstanding => :get }) end# config/routes.rb ActionController::Routing::Routes.draw do …

Read more