Merge pull request #10 from tkrajcar/master
Add README information on setting default values for enums with multiple values.
This commit is contained in:
commit
3fda46a9a8
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user