Sha256: 2824009f40714ec61a00f798fb2a6e623d8ef38f7321cd9bf2ff68dd79865afb
Contents?: true
Size: 841 Bytes
Versions: 14
Compression:
Stored size: 841 Bytes
Contents
# -*- coding: utf-8 -*- module DataMapper module Validations module Fixtures class Event # # Behaviors # include ::DataMapper::Resource # # Properties # property :id, Serial property :name, String, :required => true property :starts_at, DateTime property :ends_at, DateTime # # Validations # validates_with_method :starts_at, :method => :ensure_dates_order_is_correct # # API # def ensure_dates_order_is_correct if starts_at && ends_at && (starts_at <= ends_at) true else [false, "Start time cannot be after end time"] end end end # Event end # Fixtures end # Validations end # DataMapper
Version data entries
14 entries across 14 versions & 2 rubygems