Recently, I had a task which used MongoDB as its database. At the beginning, I used MongoMapper as the ORM but finally I found out that I couldn’t use Devise with MongoMapper as the ORM. After searched some articles, it said that I need to use Mongoid if I were to use Devise as its application’s authorization mechanism. Right now, I want to share you my experience installing those two stuffs in Rails 3.
- Mongoid These are the steps to install mongoid in your rails 3 :
- Rund command ‘em install mongoid –pre’
- Run command gem install bson_ext
- Put those installed gems in your Gemfile
- To make sure that everything’s installed properly, please run : “bundle install”
- Now you can run command rails generate mongoid:config and it will generate a file config/mongoid.yml
That’s it and your mongoid has been set up well.