Is there any Ruby CouchDB wrapper which behaves like ActiveRecord adapter?
There are several good CouchDB wrappers available, like SimplyStored, CouchFoo, CouchRest and others, but none of them seems to mimic ActiveRecord adapter. To be precise, what I need is:
- Setting database access parameters in
config/database.yml
in a common way instead of adding some magical commands toconfig/environments.rb
. - Support for code-generating commands like
rails generate scaffold
orrails generate model
. - Support for the features that RDBs and DDBs have in common (transactions and so on).
What I do not expect them to do:
- Be fully compatible with relational database adapters (in other words, I do not expect everything to work after just changing
adapter: couchdb
toadapter: sqlite3
). - Mimic any particular ORM feature.
So, the question is, does such adapter already exist? And if not, is there some reason people do not implement this? I am 开发者_开发知识库thinking about writing such adapter myself or maybe adding this functionality to some existing wrapper, but I'd like to make sure I don't miss something.
So, the question is, does such adapter already exist?
No, it doesn't.
And if not, is there some reason people do not implement this?
Because CouchDB is not a relational database. If you need a RDB, then you probably want to use ActiveRecord, not forcing a Document Database to behave like a Relational Database.
CouchRest CouchModel is a project which uses an API very similar to ActiveRecord. In facts, it implements ActionModel
without loosing the focus that CouchDB is not a Relational Database.
While not exactly what you are looking for, @langalex' CouchPotato, which builds on CouchRest is an approximation: https://github.com/langalex/couch_potato
精彩评论