Sha256: d123d1724d8fcf0efa41e141a5bad56af7245a3ee7c8cffca58ddf1deb4aecbc

Contents?: true

Size: 653 Bytes

Versions: 3

Compression:

Stored size: 653 Bytes

Contents

class Person < DataMapper::Base
  property :name, :string
  property :age, :integer
  property :occupation, :string
  property :type, :class
  property :notes, :text
  property :date_of_birth, :date
  
  embed :address do
    property :street, :string
    property :city, :string
    property :state, :string, :size => 2
    property :zip_code, :string, :size => 10
    
    def city_state_zip_code
      "#{city}, #{state} #{zip_code}"
    end
    
  end
  
  class Location < DataMapper::EmbeddedValue
    property :city, :string
    property :state, :string, :size => 2

    def to_s
      "#{city}, #{state}"
    end
  end
  
  embed Location
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datamapper-0.2.1 spec/models/person.rb
datamapper-0.2.2 spec/models/person.rb
datamapper-0.2.3 spec/models/person.rb