Add information on setting default values for enums with multiple values.

This commit is contained in:
Tim Krajcar 2014-05-30 19:47:04 -07:00
parent fd8063da6d
commit 97bc810bff

View File

@ -141,6 +141,14 @@ user.administrator? # => false
user.roles # => [:basic, :manager] 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
Validations are baked in by default, and ensure that the value(s) set in Validations are baked in by default, and ensure that the value(s) set in