Skip to content

Commit

Permalink
active_model is now the default validation framework
Browse files Browse the repository at this point in the history
  • Loading branch information
langalex committed Mar 1, 2011
1 parent 3670acd commit 150ac7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions README.md
Expand Up @@ -48,7 +48,7 @@ Or with authentication

CouchPotato::Config.database_name = "http://username:password@example.com:5984/name_of_the_db"

Optionally you can configure which framework you want to use for validations (either validatable or ActiveModel)
Optionally you can configure which framework you want to use for validations (either validatable or ActiveModel (default))

CouchPotato::Config.validation_framework = :validatable | :active_model

Expand Down Expand Up @@ -193,7 +193,7 @@ You can also force a dirty state:

#### Object validations

Couch Potato uses the validatable library for validation (http://validatable.rubyforge.org/)\
Couch Potato by default uses ActiveModel for validation

class User
property :name
Expand All @@ -202,7 +202,9 @@ Couch Potato uses the validatable library for validation (http://validatable.rub

user = User.new
user.valid? # => false
user.errors.on(:name) # => [:name, 'can't be blank']
user.errors[:name] # => ['can't be blank']

If you want you can use [Validatable](http://validatable.rubyforge.org/) by setting `CouchPotato::Config.validation(http://validatable.rubyforge.org/)\_framework = :validatable`

#### Finding stuff / views / lists

Expand Down
2 changes: 1 addition & 1 deletion lib/couch_potato.rb
Expand Up @@ -10,7 +10,7 @@
unless defined?(CouchPotato)
module CouchPotato
Config = Struct.new(:database_name, :validation_framework).new
Config.validation_framework = :validatable # default to the validatable gem for validations
Config.validation_framework = :active_model

# Returns a database instance which you can then use to create objects and query views. You have to set the CouchPotato::Config.database_name before this works.
def self.database
Expand Down

0 comments on commit 150ac7f

Please sign in to comment.