Fork me on GitHub

CouchRest and CouchRest Model

CouchRest Model

CouchRest Model adds additional functionality to the standard CouchRest Document. ActiveModel is used as a base and provides features such as setting properties, callbacks, typecasting, dirty tracking, and validations.

Installation

Simply include the library in your Rails 3 (or 3.1) project’s Gemfile:

gem :couchrest_model, '~> 1.2.0.beta'

After a quick bundle install you’ll now be able to begin creating your CouchRest Models. For more details on configuring the database connection, see the configuration section.

Generating Models

Generate your first model:

rails generate model person

This will create a app/models/person.rb containing the most basic model definition:

class Person < CouchRest::Model::Base
end

From here you can now start to add properties to the model.

blog comments powered by Disqus