Skip to content

Instantly share code, notes, and snippets.

@mattetti
Created September 7, 2008 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattetti/9265 to your computer and use it in GitHub Desktop.
Save mattetti/9265 to your computer and use it in GitHub Desktop.
# note that we are declaring the 2 following dependencies in init.rb:
# dependencies "dm-validations"
# dependencies "dm-timestamps"
class Client
include DataMapper::Resource
property :id, Integer, :serial => true
property :name, String, :length => 3..150
property :email, String
property :city, String, :lazy => true
property :zip_code, String, :field => 'postal_code', :lazy => true
property :phone, String, :lazy => true
property :address, String, :lazy => true
property :created_at, Date, :lazy => true
validates_present :name
validates_format :email, :as => :email_address
validates_is_unique :name, :email
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment