Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby Rails _without_ ActiveRecord

I'm looking for any pointers on how to write a rails web app without ActiveRecord.

A doc or an example of a (not too complex) web app using storage backends other than a relational database would be greatly appreciated.

It's not clear on what should be implemented in the model classes in order to make the rails app work without the ActiveRecord layer.

Thanks,

like image 249
devlearn Avatar asked Jul 16 '26 16:07

devlearn


2 Answers

Of course it's possible, here, for example, MongoMapper is used instead of ActiveRecord:

http://railstips.org/blog/archives/2009/07/23/getting-started-with-mongomapper-and-rails/

like image 85
Mladen Jablanović Avatar answered Jul 18 '26 06:07

Mladen Jablanović


Note that this will seem a lot easier with Rails 3. Rails team spent a lot of efforts on ORM agnosticism when pushing to beta. They've created a public API (ActiveModel) for different ORMs to implement, so that an ORM can serve as a drop-in replacement for ActiveRecord. That way you'll just be able to define models in terms of your ORM without any extra efforts.

DataMapper already has an implementation of ActiveModel in dm-rails, and there'll be more to come.

See this post by Yehuda Katz for details.

like image 25
alex.zherdev Avatar answered Jul 18 '26 05:07

alex.zherdev