From 97bc810bff7cbcde4616d2882b7ac6b092a9d89e Mon Sep 17 00:00:00 2001 From: Tim Krajcar Date: Fri, 30 May 2014 19:47:04 -0700 Subject: [PATCH] Add information on setting default values for enums with multiple values. --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 39cc9fb..2ef7ad4 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,14 @@ user.administrator? # => false user.roles # => [:basic, :manager] ``` +Since the underlying datatype for storing values is an array, if you +need to specify default(s), ensure you use an array: + +```ruby +enum :roles, [:noob, :author, :editor], :multiple => true, :default => [:author, :editor] # two defaults +enum :roles, [:noob, :author, :editor], :multiple => true, :default => [] # no default +``` + ## Validations Validations are baked in by default, and ensure that the value(s) set in