Dealing with Missing Data on the Frontend

March 21, 2011

What if you got an unexpected result from an ActiveRecord query? If it’s important for the current page, rendering a 500 is a good idea. If the data is being used for a non-vital section, it’s best to render the page without the section: @manager = Manager.find(params[:id]) rescue nil <div id=”sidebar”> <% if @manager.nil? %>… Read more

Factory > Fixtures

December 17, 2010

In general, using fixtures in testing is a big no no. Not only does it become a maintenance nightmare, it can also significantly slow down your test suite. Instead, the general practice should be to build out factories. I personally like using machinist for its terse syntax, but because our front end stack relies on…

Models, they make everything look good

August 31, 2010

One of the most common best practices in Rails is to keep the controller light weight. This helps maintain the code’s readability maintainability, and refactorability (just like coding, I make stuff up). This is often done by pushing as much of the business logic as you can (where it still makes sense) down into a… Read more