README.md in couchrest_model-2.0.4 vs README.md in couchrest_model-2.1.0.beta1
- old
+ new
@@ -5,11 +5,11 @@
CouchRest Model helps you define models that are stored as documents in your CouchDB database.
It supports useful features such as setting properties with typecasting, callbacks, validations, associations, and helps
with creating CouchDB views to access your data.
-CouchRest Model uses ActiveModel for a lot of the magic, so if you're using Rails, you'll need at least version 3.0. The latest release (since 2.0.0) is Rails 4.0 compatible, and we recommend Ruby 2.0+.
+CouchRest Model uses ActiveModel for a lot of the magic, so if you're using Rails, you'll need at least version 3.0. Releases since 2.0.0 are Rails 4.0 compatible, and we recommend Ruby 2.0+.
## Documentation
Please visit the documentation project at [http://www.couchrest.info](http://www.couchrest.info). Your [contributions](https://github.com/couchrest/couchrest.github.com) would be greatly appreciated!
@@ -58,13 +58,13 @@
prefix: project
suffix: test
username: test
password: user
-Note that the name of the database is either just the prefix and suffix combined or the prefix plus any text you specifify using `use_database` method in your models with the suffix on the end.
+Note that the name of the database is either just the prefix and suffix combined or the prefix plus any text you specify using `use_database` method in your models with the suffix on the end.
-The example config above for example would use a database called "project_test". Heres an example using the `use_database` call:
+The example config above for example would use a database called "project_test". Here's an example using the `use_database` call:
```ruby
class Project < CouchRest::Model::Base
use_database 'sample'
end
@@ -138,9 +138,18 @@
@cat = Cat.new
@cat.update_attributes(:name => 'Felix', :random_text => 'feline')
@cat.new? # false
@cat.random_text # Raises error!
+
+# Fetching by views, loading all results into memory
+cats = Cat.by_name.all
+cats.first.name # "Felix"
+
+# Streaming views, for efficient memory usage
+Cat.by_name.all do |cat|
+ puts cat.name
+end
```
## Development
### Preparations