README.markdown in couchpillow-0.4.5 vs README.markdown in couchpillow-0.4.6

- old
+ new

@@ -20,11 +20,11 @@ ## Installation gem install couchpillow -## How To Use +## Quick Start require 'couchpillow' class MyDocument < CouchPillow::Document type :my_document @@ -60,20 +60,51 @@ doc = User.new( { :email => 'john@email.com' }, '123' ) doc.email # 'john@email.com' doc.save! # { - # '_id': '123', + # '_id': 'user::123', # '_type': 'user', # '_created_at': '2014-07-04 00:00:00 UTC' # '_updated_at': '2014-07-04 00:00:00 UTC' # 'email': 'john@email.com', # } + +### Document-Level Directives + +The following are directives that can be used to trigger specific behaviors +at the Document level. + +* `type(T)` + + Set the type of the Document. + +* `type_prefix(true|false)` + + Default to `true`. If set to false, it removes prefixing document id with + the document type. Leaving this to true is the recommended behavior to avoid + id conflicts between different types of documents, especially when custom + ids are being used. + +* `attribute(name, &block)` + + Declares an attribute for this Document. You can specify additional + directives for each attribute. See Attributes section. + +* `db(connection)` + + Sets the database connections. If set once, it will set that connection as + the primary connection. Any subsequent calls to this directive will set + those connections as secondary connections. See Multiple DB Connections + section. + + + ### Attributes -Using Attribute Directives: +Using Attribute Directive: class User < CouchPillow::Document type :user attribute :email do @@ -162,11 +193,11 @@ doc.save! # This gets saved to the 128.128.128.128/mymemcache_bucket You can also specify multiple `db` directives. The first time the `db` directive is called, it sets that connection as the primary connection, as the -above example shows. Any subsequent calls will insert that DB connection as -secondary connections, which will only be trigger on write (`save!`, `update!`, +above example shows. Any subsequent calls will insert those DB connection as +secondary connections, which will only trigger on write (`save!`, `update!`, and `delete!`). class Token < CouchPillow::Document type :token