enumerize 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/enumerize/hooks/formtastic.rb +1 -1
- data/lib/enumerize/hooks/simple_form.rb +1 -1
- data/lib/enumerize/version.rb +1 -1
- data/test/formtastic_test.rb +8 -0
- data/test/simple_form_test.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7398da2a4b6b495fe048cf6872660b0c8ac55278197f0f31e04e6de360691152
|
4
|
+
data.tar.gz: 88d7a066d937fa8654b9878a85d16d2ac4f9048be29e211ba26d828967c60041
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14ef4618d73da931a8cfeae83a9d650c9ae98d5bf876bdc72b151e182bbb345c86fe7fe495f8f096f61f170a75b29a12478b7f02081d277cd467c541bf2bf158
|
7
|
+
data.tar.gz: d8868aa8ac94d9920de256382460f2ea36343a72b89b9aa46ce0369248b940602c27014da4ff7fbee411d43b7eb0ada4442866857ae779414d0fdd0f57902a60
|
data/CHANGELOG.md
CHANGED
@@ -5,7 +5,7 @@ module Enumerize
|
|
5
5
|
module FormtasticFormBuilderExtension
|
6
6
|
|
7
7
|
def input(method, options={})
|
8
|
-
klass = object.to_model.class
|
8
|
+
klass = object && object.to_model.class
|
9
9
|
|
10
10
|
if klass.respond_to?(:enumerized_attributes) && (attr = klass.enumerized_attributes[method])
|
11
11
|
options[:collection] ||= attr.options
|
@@ -17,7 +17,7 @@ module Enumerize
|
|
17
17
|
private
|
18
18
|
|
19
19
|
def add_input_options_for_enumerized_attribute(attribute_name, options)
|
20
|
-
klass = object.to_model.class
|
20
|
+
klass = object && object.to_model.class
|
21
21
|
|
22
22
|
if klass.respond_to?(:enumerized_attributes) && (attr = klass.enumerized_attributes[attribute_name])
|
23
23
|
options[:collection] ||= attr.options
|
data/lib/enumerize/version.rb
CHANGED
data/test/formtastic_test.rb
CHANGED
@@ -124,4 +124,12 @@ class FormtasticSpec < MiniTest::Spec
|
|
124
124
|
|
125
125
|
assert_select 'input[type=text]'
|
126
126
|
end
|
127
|
+
|
128
|
+
it 'does not affect forms without object' do
|
129
|
+
concat(semantic_form_for('') do |f|
|
130
|
+
f.input(:name)
|
131
|
+
end)
|
132
|
+
|
133
|
+
assert_select 'input[type=text]'
|
134
|
+
end
|
127
135
|
end
|
data/test/simple_form_test.rb
CHANGED
@@ -128,4 +128,12 @@ class SimpleFormSpec < MiniTest::Spec
|
|
128
128
|
|
129
129
|
assert_select 'input.string'
|
130
130
|
end
|
131
|
+
|
132
|
+
it 'does not affect forms without object' do
|
133
|
+
concat(simple_form_for('') do |f|
|
134
|
+
f.input(:name)
|
135
|
+
end)
|
136
|
+
|
137
|
+
assert_select 'input.string'
|
138
|
+
end
|
131
139
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enumerize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Nartimov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|