README.md in couchrest_model-1.0.0.beta7 vs README.md in couchrest_model-1.0.0.beta8

- old
+ new

@@ -11,11 +11,28 @@ CouchRest Model only supports CouchDB 0.10.0 or newer. ## Install - $ sudo gem install couchrest_model +### From Gem + +CouchRest Model depends on Rails 3's ActiveModel which has not yet been released. You'll need to add +`--pre` to the end of the gem install until the dependencies are stable: + + $ sudo gem install couchrest_model --pre + +### Bundler + +If you're using bundler, just define a line similar to the following in your project's Gemfile: + + gem 'couchrest_model' + +You might also consider using the latest git repository. All tests should pass in the master code branch +but no guarantees! + + gem 'couchrest_model', :git => 'git://github.com/couchrest/couchrest_model.git' + ## General Usage require 'couchrest_model' @@ -55,11 +72,11 @@ with a property, but a property may not have any attributes associated if none have been set. In its simplest form, a property will only create a getter and setter passing all attribute data directly to the database. Assuming the attribute -provided responds to +to_json+, there will not be any problems saving it, but when loading the +provided responds to `to_json`, there will not be any problems saving it, but when loading the data back it will either be a string, number, array, or hash: class Cat < CouchRest::Model::Base property :name property :birthday @@ -108,11 +125,11 @@ Adding the +:default+ option will ensure the attribute always has a value. Defining a property as read-only will mean that its value is set only when read from the database and that it will not have a setter method. You can however update a read-only -attribute using the +write_attribute+ method: +attribute using the `write_attribute` method: class Cat < CouchRest::Model::Base property :name, String property :lives, Integer, :default => 9, :readonly => true @@ -143,11 +160,11 @@ @cat.nicknames << 'Buffy' @cat.nicknames == ['Buffy'] When anything other than a string is set as the class of a property, the array will be converted -into special wrapper called a CastedArray. If the child objects respond to the 'casted_by' method +into special wrapper called a CastedArray. If the child objects respond to the `casted_by` method (such as those created with CastedModel, below) it will contain a reference to the parent. ## Casted Models CouchRest Model allows you to take full advantage of CouchDB's ability to store complex @@ -212,20 +229,20 @@ ## Validations CouchRest Model automatically includes the new ActiveModel validations, so they should work just as the traditional Rails validations. For more details, please see the ActiveModel::Validations documentation. -CouchRest Model adds the possibility to check the uniqueness of attributes using the @validates_uniqueness_of@ class method, for example: +CouchRest Model adds the possibility to check the uniqueness of attributes using the `validates_uniqueness_of` class method, for example: class Person < CouchRest::Model::Base property :title, String validates_uniqueness_of :title end The uniqueness validation creates a new view for the attribute or uses one that already exists. You can -specify a different view using the +:view+ option, useful for when the @unique_id@ is specified and +specify a different view using the `:view` option, useful for when the `unique_id` is specified and you'd like to avoid the typical RestClient Conflict error: unique_id :code validates_uniqueness_of :code, :view => 'all' @@ -305,15 +322,15 @@ ## Docs API: [http://rdoc.info/projects/couchrest/couchrest_model](http://rdoc.info/projects/couchrest/couchrest_model) -Check the wiki for documentation and examples [http://wiki.github.com/couchrest/couchrest](http://wiki.github.com/couchrest/couchrest) +Check the wiki for documentation and examples [http://wiki.github.com/couchrest/couchrest_model](http://wiki.github.com/couchrest/couchrest_model) ## Contact -Please post bugs, suggestions and patches to the bug tracker at [http://github.com/couchrest/couchrest/issues](http://github.com/couchrest/couchrest/issues). +Please post bugs, suggestions and patches to the bug tracker at [http://github.com/couchrest/couchrest_model/issues](http://github.com/couchrest/couchrest_model/issues). Follow us on Twitter: [http://twitter.com/couchrest](http://twitter.com/couchrest) Also, check [http://twitter.com/#search?q=%23couchrest](http://twitter.com/#search?q=%23couchrest)