1

I have a new Ruby on Rails installation where I can see the default start-page.

I followed this guide in order to install MongoDB to Rails.

Now I get this error when running rake test:

**Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance.
  You can install the extension as follows:
  gem install bson_ext

  If you continue to receive this message after installing, make sure that the
  bson_ext gem is in your load path and that the bson_ext and mongo gems are of the same version.

I have installed the bson_ext gem, which means that now bson_ext in not in my load path or that the gems are not the same version.

Where is the load path? How can I change it? How do I check if the gems are the same version?

2 Answers 2

5

If you're using Ruby on Rails 3+, you should check that the bson_ext gem is referenced in your Gemfile.

Sign up to request clarification or add additional context in comments.

4 Comments

It is not, how do I add it? Sorry but I'm new to Rails. Switching from long term relationship with PHP =)
Ok I think this fixed it: gem "bson_ext". Thanks!
In your gemfile add the line gem "bson_ext" and then run bundle update from your command line.
Yep, you got it. You can either run bundle update as @theTRON mentioned, or bundle install.
2

Open up Gemfile (in your rails app's root directory) and add a line that says: bson_ext

You should have:

gem mongo
gem bson_ext

Also here is some more info from 10gen docs on running tests in rails:

Running Tests A slight modification is required to get rake test working (thanks to John P. Wood). Create a file lib/tasks/mongo.rake containing the following:

namespace :db do
  namespace :test do
    task :prepare do
      # Stub out for MongoDB
    end
  end
end

Now the various rake test tasks will run properly. See John's post for more details.

They also reference John Wood's post which is quite good.

1 Comment

You are referring to the same article as the one in my question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.