couchrest_model/spec/fixtures/more/card.rb
Matt Aimonetti dfdcd79a58 Started added a validation mixin
Usage:
  class Invoice < CouchRest::ExtendedDocument
    include CouchRest::Validation

    property :client_name
    property :employee_name
    property :location

    # Validation
    validates_present :client_name, :employee_name
    validates_present :location, :message => "Hey stupid!, you forgot the location"

  end
2009-02-02 19:21:32 -08:00

16 lines
440 B
Ruby

class Card < CouchRest::ExtendedDocument
# Include the validation module to get access to the validation methods
include CouchRest::Validation
# Set the default database to use
use_database TEST_SERVER.default_database
# Official Schema
property :first_name
property :last_name, :alias => :family_name
property :read_only_value, :read_only => true
# Validation
validates_present :first_name
end