Skip to content
This repository was archived by the owner on May 16, 2022. It is now read-only.

Commit 3fda46a

Browse files
committed
Merge pull request #10 from tkrajcar/master
Add README information on setting default values for enums with multiple values.
2 parents fd8063d + 97bc810 commit 3fda46a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ user.administrator? # => false
141141
user.roles # => [:basic, :manager]
142142
```
143143

144+
Since the underlying datatype for storing values is an array, if you
145+
need to specify default(s), ensure you use an array:
146+
147+
```ruby
148+
enum :roles, [:noob, :author, :editor], :multiple => true, :default => [:author, :editor] # two defaults
149+
enum :roles, [:noob, :author, :editor], :multiple => true, :default => [] # no default
150+
```
151+
144152
## Validations
145153

146154
Validations are baked in by default, and ensure that the value(s) set in

0 commit comments

Comments
 (0)