Search code examples
ruby-on-rails-3.1yajl

no such file to load -- yajl


I have this in my seeds file

 require 'rubygems'
 require 'yajl'

and I keep getting this error

 rake aborted!
 no such file to load -- yajl

Tasks: TOP => db:seed (See full trace by running task with --trace)

The code works when I run it outside of the seeds file. Is there some reason that I cant require the gem in the seeds file?

btw: Rails 3.0.9 / ruby 1.9.2


Solution

  • Add the following to your Gemfile

    gem "yajl-ruby"