Rails+MongoDB: "No such file to load"
New to MongoDB and trying to get a second test project working. I emphasize second because I'm wondering if that may be part of the problem as in /data/db/
i still have the files for the first proof-of-concept MongoDB <- MongoID -> Rails project that I got up and running without a problem a few weeks ago.
Now I'm experimenting with building a new Rails project from scratch with some flags (-T -O -J
) and then running the associated install/config generators: mongoid:config, rspec:install, jquery:install
.
So far so good... until I generate my first scaffold and then try to access it and get the response:
"No such file to load -- vendor"
now, I'm not too surprised as there's no new xxx_development.x
files in /data/db/
. But I don't remember creating them the first time and tutorials I've been using don't mention such a step? Early onset senility? Or is something amiss? Perhaps MongoDB (or MongoID) can only handle one MongoDB per db directory?!?
#Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.4'
开发者_JAVA技巧gem 'mongoid', '2.0.0.rc.7'
gem 'bson_ext'
...
Using default mongoid.yml
.
I've searched S.O. for related problems and there were many but most either have problems loading a gem, which is not my case, or state that the bson_ext
version must match the mongoid
version.. but most of these cases seem old and now I don't even think that's possible with mongoid
approaching 2.0
and bson_ext
still at 1.2
.
Figured it out by building another test app from scratch. there seems to be a bug (or my lack of understanding) somewhere perhaps involved with the -J
flag to rails new
(or with the combo of using the -J
, -T
& -O
flags at same time?). Anyway, it uncomments the following line in application.rb
:
config.action_view.javascript_expansions[:defaults] = %w()
which should read:
config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
adding "jquery rails
" made the app work... not sure what the resource name had to do with the original error message!?! Red Herring?
精彩评论