Merge pull request #10 from tkrajcar/master

Add README information on setting default values for enums with multiple values.
This commit is contained in:
Nicholas Bruning 2014-05-31 20:53:04 +10:00
commit 3fda46a9a8

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