Created
May 17, 2011 09:59
-
-
Save carlhoerberg/976228 to your computer and use it in GitHub Desktop.
How to list DataMapper enum options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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