enum_help 0.0.8 → 0.0.9
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/README.md +10 -1
- data/lib/enum_help/simple_form.rb +2 -1
- data/lib/enum_help/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66948f4f12b02670eca05becf8556dc1c4b765f7
|
4
|
+
data.tar.gz: f2a5ffef59a3f708dddaa285df1e4cd1cb17a8d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d276091006d58d131fe38c1467a5fdf595592814cbfeb6a519fedd4200f9ee16d106de237f5cbb7916e0aa5bd6126e8cc62b197dd28a3b4880f9519fa53115a4
|
7
|
+
data.tar.gz: c999f3fa91dd5c9485c6c7069cf5872b4fc762e78f8e7956a9681d5e46ea2a1206a2555d079e03cc57038ab8c2826c145e5a9606d3eeaedc5b282244527bb074
|
data/README.md
CHANGED
@@ -47,7 +47,7 @@ You can call:
|
|
47
47
|
order.status_i18n # if you have an i18n file defined as following, it will return "未支付".
|
48
48
|
# > 未支付
|
49
49
|
|
50
|
-
In _form.html.erb using
|
50
|
+
In _form.html.erb using simple_form:
|
51
51
|
|
52
52
|
<%= f.input :status %>
|
53
53
|
|
@@ -80,6 +80,15 @@ I18n local file example:
|
|
80
80
|
failed: 失败
|
81
81
|
destroyed: 已删除
|
82
82
|
|
83
|
+
|
84
|
+
## Notice
|
85
|
+
If you want to use enum feature,
|
86
|
+
field of your table can't be named with reference.
|
87
|
+
When it is named with 'reference' and define enum in model file, there will be raise an error as below:
|
88
|
+
|
89
|
+
NoMethodError: super: no superclass method `enum' for...
|
90
|
+
|
91
|
+
|
83
92
|
## Thanks
|
84
93
|
* [mrhead](https://github.com/mrhead)
|
85
94
|
* [Jin Lee](https://github.com/neojin)
|
@@ -6,8 +6,9 @@ module EnumHelp
|
|
6
6
|
|
7
7
|
def default_input_type_with_enum(*args, &block)
|
8
8
|
att_name = (args.first || @attribute_name).to_s
|
9
|
+
|
9
10
|
return :enum if (args.last.is_a?(Hash) ? args.last[:as] : @options[:as]).nil? &&
|
10
|
-
object.class.respond_to?(att_name.pluralize)
|
11
|
+
object.class.respond_to?(att_name.pluralize) && att_name.pluralize != "references"
|
11
12
|
|
12
13
|
default_input_type_without_enum(*args, &block)
|
13
14
|
end
|
data/lib/enum_help/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enum_help
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lester Zhao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|