str_enum 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +14 -2
- data/lib/str_enum/version.rb +1 -1
- data/lib/str_enum.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1af2d9185c46190d199572f4ead3c7be624044b
|
4
|
+
data.tar.gz: 2239d75b7693917cd5e7843ea5d168ee418b93e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9f5c6b3737eb8d34180c35b81806e341dc8f2cce0a0d8d2c5e67b334b46fa54b755f502a14138ea4f8a4db5b842c42ff1eaedfbc4deaa529e22fad83d82356f
|
7
|
+
data.tar.gz: 32c14db6244b386b217fcc16444986ebcf3ab5ed0f0837a406d2c17ded2f299fcda23e2e881ec93e3540de05263c4d0aede531206a44d2e7a4249519cbba80d5
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -16,7 +16,13 @@ Add this line to your application’s Gemfile:
|
|
16
16
|
gem 'str_enum'
|
17
17
|
```
|
18
18
|
|
19
|
-
|
19
|
+
Add a string column to your model.
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
add_column :users, :status, :string
|
23
|
+
```
|
24
|
+
|
25
|
+
And use:
|
20
26
|
|
21
27
|
```ruby
|
22
28
|
class User < ActiveRecord::Base
|
@@ -47,6 +53,12 @@ user.active?
|
|
47
53
|
user.archived?
|
48
54
|
```
|
49
55
|
|
56
|
+
#### Forms
|
57
|
+
|
58
|
+
```erb
|
59
|
+
<%= f.select :status, User.statuses.map { |s| [s.titleize, s] } %>
|
60
|
+
```
|
61
|
+
|
50
62
|
## Options
|
51
63
|
|
52
64
|
Choose which features you want with:
|
@@ -57,7 +69,7 @@ class User < ActiveRecord::Base
|
|
57
69
|
end
|
58
70
|
```
|
59
71
|
|
60
|
-
Prevent name collisions with the `prefix` option.
|
72
|
+
Prevent method name collisions with the `prefix` option.
|
61
73
|
|
62
74
|
```ruby
|
63
75
|
class User < ActiveRecord::Base
|
data/lib/str_enum/version.rb
CHANGED
data/lib/str_enum.rb
CHANGED