# Ror with MongoDB problems and questions

**URL:** <https://www.ruby-forum.com/t/ror-with-mongodb-problems-and-questions/191099>\
**Category:** Rails\
**Created:** [July 5, 2010, 1:31pm UTC](https://www.ruby-forum.com/t/ror-with-mongodb-problems-and-questions/191099 "2010-07-05T13:31:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bbce88/32.png) [@fell](https://www.ruby-forum.com/u/fell)\
**Post date:** [July 5, 2010, 1:31pm UTC](https://www.ruby-forum.com/t/ror-with-mongodb-problems-and-questions/191099/1 "2010-07-05T13:31:17Z")

</div>

Hi  
Ok what i want to do is work with MongoDB using standard ActiveRecord  
methods like Model.all Model.find and so on but whithout ActiveRecord  
itself.  
First to notice Ror using database.yml where we create connection config  
like  
define:  
adapter  
database  
login  
password  
socket

ok for mongodb we have no adapter and then we cann’t use database.yml at  
all.  
We can create own mongodb.yml where we can define:  
server  
port  
database  
how ror knows wich config to use(database.yml or mongodb.yml) i don’t  
know.

and then define that in mongo\_config.rb in initialize folder. Like  
MongoMapper.connection =  
MongoMapper.database =

at [railscasts.com](http://railscasts.com) Ryan suggest only adding MongoMapper.database = “base”  
in mmongo\_config.rb ( gem ‘mongo\_mapper’ required in Gemfile).

After all you make model like this  
class Person  
include MongoMapper::Document  
key:name  
key:lname

it should use mongo\_mapper but it fails.  
It doesn’t work. At least with Rails 3beta and 1.9.1. Because it still  
using ActiveRecord some how and database.yml accordingly. And server  
doesn’t work and console.  
So i didn’t find a method to switch off ActiveRecord easily ( earlier it  
can be done by config.frameworks -= {:active\_record} and it doesn’t work  
for rails 3.)

Ok what to do with this ? Tell me your experience.

And for Ror core team it would be wise to implement switching on off  
gems like ActiveRecord for application and (or) make adapter for  
document-based DB’s because popularity for this kind of DB’s now is  
growing pretty fast. And it will be easy to use mongodb adapter instead  
of making custom implementations.

---

<div class="post-metadata">

**Author:** ![fell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bbce88/32.png) [@fell](https://www.ruby-forum.com/u/fell)\
**Post date:** [July 5, 2010, 3:56pm UTC](https://www.ruby-forum.com/t/ror-with-mongodb-problems-and-questions/191099/2 "2010-07-05T15:56:58Z")

</div>

ok i guess i fixed problem  
I installed “devise” - auth manager and it works only with active\_record  
and mongoid and doesn’t support mongo\_mapper so far.  
So in config was active\_record by default.
