2009-02-02 14:56:17 -08:00
|
|
|
class Card < CouchRest::ExtendedDocument
|
2009-02-02 19:21:32 -08:00
|
|
|
# Include the validation module to get access to the validation methods
|
|
|
|
include CouchRest::Validation
|
2009-02-10 02:15:39 -08:00
|
|
|
# set the auto_validation before defining the properties
|
|
|
|
auto_validate!
|
2009-02-02 19:21:32 -08:00
|
|
|
|
|
|
|
# Set the default database to use
|
2009-05-27 18:16:50 -07:00
|
|
|
use_database DB
|
2009-02-02 19:21:32 -08:00
|
|
|
|
|
|
|
# Official Schema
|
2009-02-02 14:56:17 -08:00
|
|
|
property :first_name
|
|
|
|
property :last_name, :alias => :family_name
|
|
|
|
property :read_only_value, :read_only => true
|
2009-06-07 18:51:31 -07:00
|
|
|
property :cast_alias, :cast_as => 'Person', :alias => :calias
|
|
|
|
|
2009-02-02 14:56:17 -08:00
|
|
|
|
2009-02-03 17:33:31 -08:00
|
|
|
timestamps!
|
|
|
|
|
2009-02-02 19:21:32 -08:00
|
|
|
# Validation
|
|
|
|
validates_present :first_name
|
|
|
|
|
2009-02-02 14:56:17 -08:00
|
|
|
end
|