Browse files

active_model is now the default validation framework

  • Loading branch information...
1 parent 3670acd commit 150ac7f090e96c94cd5e86d205ec2aeebd2a3ef9 @langalex committed Mar 1, 2011
Showing with 6 additions and 4 deletions.
  1. +5 −3 README.md
  2. +1 −1 lib/couch_potato.rb
View
8 README.md
@@ -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
@@ -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
@@ -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
View
2 lib/couch_potato.rb
@@ -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

0 comments on commit 150ac7f

Please sign in to comment.