Daily Code Reading #2 – Facets Hash#zipnew

I’m continuing my look at Ruby Facets today, this time looking at another Hash method. I use Hashes everyday in Rails programming so if I can pick up some new techniques, I can put them to use right away. Today’s subject is Hash#zipnew. The Code 1 2 3 4 5 6 # File lib/core/facets/hash/zipnew.rb, line …

Read more

Code Reading – New Ideas and New Solutions

My daily refactorings have improved my existing code up to my current knowledge of Ruby. Now I need a way to learn new ideas and ways to write Ruby. I’m going to start doing a daily code reading and review every day: posting it reading over it taking notes on the interesting techniques try to …

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