enum_select_rails 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -8
- data/lib/enum_select_rails/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5d88b0b9e06e40fecec284a27408397f10c9b9b02296f6b3048ace2f3f54bfe
|
4
|
+
data.tar.gz: f362663c5cfc0542e1ceac2b177b41cf58b56d962b5c838593e322e185eee094
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73874fdce322c2928b233e458aae1900bef5d50882f553237cf866675a5aa188f56dbbe5b5ff5ad93d00f0af2d324fd8a02f25d0917c91d4eb738342d6df05e4
|
7
|
+
data.tar.gz: a148579af25583e261cd22d516dfd8439e9c5a5ad3ad216086341c8b4843a1419f6436bbbfe39a71234d76558438d7c2c201b02f584b5b99c8f16e6332b487bc
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# EnumSelectRails
|
2
|
+
|
2
3
|
A form helper for the enum field of Rails model.
|
3
4
|
|
4
|
-
|
5
|
+
You can easily generate select tag which has enum field options.
|
6
|
+
|
7
|
+
![image](https://user-images.githubusercontent.com/3489430/38072782-eebbea40-3362-11e8-911b-18f56f8b9ed4.png)
|
5
8
|
|
6
|
-
```erbruby
|
7
|
-
<%= f.enum_select :your_field_name %>
|
8
|
-
```
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
Add this line to your application's Gemfile:
|
@@ -14,8 +14,30 @@ Add this line to your application's Gemfile:
|
|
14
14
|
gem 'enum_select_rails'
|
15
15
|
```
|
16
16
|
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
class User
|
21
|
+
enum gender: {
|
22
|
+
female: 2,
|
23
|
+
male: 1,
|
24
|
+
other: 9
|
25
|
+
}
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
```erbruby
|
30
|
+
<%= f.enum_select :gender %>
|
31
|
+
```
|
32
|
+
|
17
33
|
## i18n
|
18
34
|
|
35
|
+
Automatically apply i18n text into options text.
|
36
|
+
|
37
|
+
This feature is depends on [enum_help](https://github.com/zmbacker/enum_help).
|
38
|
+
|
39
|
+
![image](https://user-images.githubusercontent.com/3489430/38072879-65777b04-3363-11e8-9654-5cf1f64cee17.png)
|
40
|
+
|
19
41
|
```ruby
|
20
42
|
# Gemfile
|
21
43
|
gem 'enum_help'
|
@@ -44,9 +66,5 @@ ja:
|
|
44
66
|
other: その他
|
45
67
|
```
|
46
68
|
|
47
|
-
|
48
|
-
## Contributing
|
49
|
-
Contribution directions go here.
|
50
|
-
|
51
69
|
## License
|
52
70
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enum_select_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tanakaworld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: enum_help
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|