Tagged In ruby on rails :
Dealing with Missing Data on the Frontend
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
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…
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 moreModels, they make everything look good