One problem when running everything in a headless Vagrant instance is that you lose the ability to see Guard Rspec notifications. Actually, you don’t lose it but it’s not immediately obvious how to configure Guard. Since Guard is running inside Vagrant, it can’t display the Growl notifications on the guest operating system. However, you can [...]
There are two types of ‘Sleep’ that your MacBook Air can have: close-the-lid-sleep which will drain the battery within 24hrs; or sleep-from-the-menu-sleep which only uses about 3-5% in 24hrs. Choose wisely.
I’m falling in love with Postgres as a database but it comes fairly well locked down (good for production, not so good for development). I do all my development in a Vagrant box so a) the environment matches production and b) I don’t pollute my Mac with various conflicting versions of things. Mostly I’ve been [...]
I’m still discovering the joys of using FactoryGirl to create test data but I particularly like this pattern for creating a collection of associated objects. FactoryGirl.define do factory :list do name "My List" end trait :with_items do ignore do item_count 3 end after(:create) do |plan, evaluator| FactoryGirl.create_list(:item, evaluator.item_count, list: list) end end end Now, I [...]
It can get a bit tiresome typing bundle exec in front of every Rails command. RVM seems to have this problem solved but I’m using rbenv. alias b The quick and dirty way to add this to your .bash_profile/.bashrc file: alias b='bundle exec' Now you can just type b rake instead of bundle exec rake [...]
I had a model which wasn’t cleaning up the dependent models, even though theÂ :dependent => :destroy attribute was set on the association: class PerformancePlan < ActiveRecord::Base has_many :goals, dependent: :destroy validates_associated :goals end class Goal < ActiveRecord::Base belongs_to :plan, class_name: 'PerformancePlan' end Luckily, I’d written a spec to test that the goals were being cleaned [...]