user984621
user984621

Reputation: 48453

Rails 3.1 and MongoDB - ActiveRecords?

I try to use first time MongoDB instead of MySQL in my Rails 3.1 app and I am a bit confuse about the rules around.

I know MongoDB is NoSQL and document database and stuffs like that. But what I would like to ask, is - I am accustomed from a work with MySQL with an associations between tables and scaffold generating and migrations.

Is it possible to use here with a work in MongoDB? I try to find a good tutorial for this on Google, but I still can't find the good source about it...

Have anyone any good a tip around this things?

Many thanks in advance.

Upvotes: 1

Views: 427

Answers (2)

tomsoft
tomsoft

Reputation: 4577

Yes, I use Mongoid and it's really great.

It's very similar to ActiveRecord, and you can easily do the same things. There are also scaffolding for mongoid, for instance:

rails g scaffold article name:string content:text

will generate the article model and all the linked scaffold

Upvotes: 1

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230336

ActiveRecord won't work with MongoDB. You need another library.

I recommend Mongoid. It's good, documentation is excellent. Check it out. It installs its own generators, so you can scaffold away. Oh, and you don't need migrations with MongoDB.

I also heard good things about MongoMapper.

Upvotes: 5

Related Questions