Skip to content

Instantly share code, notes, and snippets.

@eedrummer
Created November 24, 2009 04:04
Show Gist options
  • Save eedrummer/241619 to your computer and use it in GitHub Desktop.
Save eedrummer/241619 to your computer and use it in GitHub Desktop.
class Extension
include DataMapper::Resource
property :id, Serial
property :type_id, String, :length => 200
property :requirement, String
validates_is_unique :type_id,
:message =>
"Extension with that type id already exists"
validates_format :requirement,
:with => /optional|mandatory/,
:message =>
"Extension requirement must be optional or mandatory"
validates_present :type_id, :requirement,
:message =>
"An extension must specify a typeId and requirement"
has n, :sections
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment