Sha256: 57feb1365297d30586962b8d9802d9bf610826ddabafea52e1431691da844767

Contents?: true

Size: 362 Bytes

Versions: 1

Compression:

Stored size: 362 Bytes

Contents

class Zoo < DataMapper::Base
  property :name, :string
  property :notes, :text
  property :updated_at, :datetime
  
  has_many :exhibits
  begin
  validates_presence_of :name
  rescue ArgumentError => e
    throw e unless e.message =~ /specify a unique key/
  end
  
  def name=(val)
    @name = (val == "Colorado Springs") ? "Cheyenne Mountain" : val
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datamapper-0.2.4 spec/models/zoo.rb