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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05a89bbe16f328c6b8dc7f741291a9579af4773ce619cefec6009ec53e6e9ebe
4
- data.tar.gz: 774b68ae715671f57f5cf84b11527bd58a6f31f3fc0bed3b370467550f05d72c
3
+ metadata.gz: 7398da2a4b6b495fe048cf6872660b0c8ac55278197f0f31e04e6de360691152
4
+ data.tar.gz: 88d7a066d937fa8654b9878a85d16d2ac4f9048be29e211ba26d828967c60041
5
5
  SHA512:
6
- metadata.gz: 20ffa27d5b0cf7364b3ee93ac9c9b1e769cc3c3fa0108925716eecc7c0702242ab420a0916e235be9fae4588c964fe5456b6571afe254a9de2dad5ecff24b168
7
- data.tar.gz: 1eeb005d9dbaedd1bb28e4197c6eea6f95e201f20fbd0748d464f7aa45a0139428d1f2e037b9bf01f0192a13ad10125f8fa0e098a0d1f79b02298981e183c28e
6
+ metadata.gz: 14ef4618d73da931a8cfeae83a9d650c9ae98d5bf876bdc72b151e182bbb345c86fe7fe495f8f096f61f170a75b29a12478b7f02081d277cd467c541bf2bf158
7
+ data.tar.gz: d8868aa8ac94d9920de256382460f2ea36343a72b89b9aa46ce0369248b940602c27014da4ff7fbee411d43b7eb0ada4442866857ae779414d0fdd0f57902a60
@@ -4,6 +4,12 @@
4
4
 
5
5
  ### bug fix
6
6
 
7
+ ## 2.2.1 (February 15, 2018)
8
+
9
+ ### bug fix
10
+
11
+ * Fix issue with SimpleForm/Formtastic forms without object. (by [@nashby](https://github.com/nashby))
12
+
7
13
  ## 2.2.0 (February 13, 2018)
8
14
 
9
15
  ### enhancements
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Enumerize
4
- VERSION = '2.2.0'
4
+ VERSION = '2.2.1'
5
5
  end
@@ -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
@@ -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.0
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-13 00:00:00.000000000 Z
11
+ date: 2018-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport