Hacking Off

20% Time All the Time

Squashing a Rails Cache Error Bug

I’m probably not the only one who has or will run into this, especially if others are running a new (read: >=3.x) version of Ruby on Rails, using RVM, on Dreamhost, and were following some outdated instructions from the Dreamhost Wiki on getting Rails 3 up and running.

The Active Support Cache Error Message

1
2
3
4
Exiting
/home/yourusername/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/cache.rb:65:in `rescue in lookup_store': Could not find cache store adapter for file_store (no such file to load -- active_support/cache/file_store) (RuntimeError)
  from /home/yourusername/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/cache.rb:62:in `lookup_store'
  from /home/yourusername/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/application/bootstrap.rb:54:in `block (2 levels) in <module:Bootstrap>'

Solution after the jump.

The Underlying Problem

Your gem paths are probably hosed somewhere in your configuration file. The DH Wiki suggested this:

config/environment.rb
1
2
3
# Added as a fix for DreamHost
ENV['GEM_PATH'] = '/usr/lib/ruby/gems/1.8';
ENV['GEM_HOME'] = "#{ENV['HOME']}/.gems";

Chances are that those don’t jive with your RVM gempath.

I imagine this suggestion was off too:

public/dispatch.fcgi
1
2
# Set GEM_PATH and GEM_HOME ("user" is your dreamhost user)
ENV['GEM_HOME'] ||= '/home/user/.gems'

The Good Fix

I imagine the correct fix is unborking your gem paths. I’ll investigate this in greater depth some time down the road.

Until such a time, here’s how to get around the issue.

The Sloppy Fix

1
bundle install --deployment

This will get rails to look in the RAILSROOT/vendor/bundle folder instead of your system path. Stick this in your git post-receive hook, or add it as a task to whatever deployment system you’re using, to have it execute every time you push. As solutions go, this is slow and crappy, but probably won’t kill you if your updates are infrequent.