Skip to content

Instantly share code, notes, and snippets.

@carlhoerberg
Created May 17, 2011 09:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlhoerberg/976228 to your computer and use it in GitHub Desktop.
Save carlhoerberg/976228 to your computer and use it in GitHub Desktop.
How to list DataMapper enum options
class Entity
include DataMapper::Resource
property :enum_property, Enum[:a, :b, :c]
end
Entity.enum_property.options[:flags] #=> [:a, :b, :c]
# or
Entity.enum_property.flag_option.values #=> [:a, :b, :c]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment