iliabylich/couch-orm — pull request #6 by iliabylich (2013-07-25 19:08:40+00:00)
Title: Add Query module. Add ability to upload and work with design views.

Usage:

+ Model
``` ruby
# app/models/email.rb
class Email < CouchORM::Model
attribute :username
attribute :password
attribute :subscribed

view :subscribed, client: true
end
```
+ View
```javascript
// app/couch/views.js
var EmailViews = {
"subscribed" : {
"map": function() {
if (doc.subscribed)
emit(doc);
}
}
};
```
+ Initializer (for configuration)
```ruby
# config/initializers/couch-orm.rb
CouchORM::ViewLoader.filepath = Rails.root.join("app", "couch", "views.js")
# Now CouchORM uploads this file to CouchDB whenever you change it.
```
+ Usage
```ruby
Email.subscribed
# => [#, #, ...]
```