When you eagerly load an association list using the .include option, and at the same time have a .where on...
When using virtual attributes, the attached trait can be useful to automatically copy errors from one attribute to another.
There are two distinct ways of commenting Haml markup: HTML and Ruby. HTML comments This will create an HTML comment...
To return non-HTML responses (like XLS spreadsheets), we usually use the respond_to do |format| format.xls do # send spreadsheet...
Rails 3, 4, 5, 6 config/application.rb config/environment.rb before the initialize! call (we don't usually edit this file)
Sometimes you want to fetch associations for an ActiveRecord that you already loaded, e.g. when it has deeply nested associations...
There are three ways to define your own RSpec matchers, with increasing complexibility and options: 1) Use RSpec::Matchers.define
The Git stash does not work like a one-slot clipboard and you might shoot yourself in the foot if...
An alternative to this technique is using VCR. VCR allows you to record and replay real HTTP responses, saving you...