views:

12

answers:

1

Let there is a rails 3 app with two models, a Project and Notification using the ActiveRecord adapter with MySql.

Project has various states using state_machine and when its state changes, I want the notifications to be stored and retrieved back using MongoDb?

Can this be done using rails3?

A: 

ActiveRecord is for SQL driven databases, at least you can use ActiveModel and build some custom logic to handle MongoDb.

alternatively, you can use specific MongoDB adapters: MongoMapper or Mongoid

apeacox
Since AR is also implemented on the ActiveModel's API, Can I use the Mongoid/MongoMapper just for a single/two models??
Millisami
why not? when you put files in app/models/ rails will look for models there. so you can have models derived from other classes, not necessarily AR or AM.
apeacox