simple_form 5.2.0 → 5.3.1

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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +3 -4
  5. data/lib/simple_form/components/errors.rb +1 -1
  6. data/lib/simple_form/components/label_input.rb +1 -1
  7. data/lib/simple_form/form_builder.rb +1 -1
  8. data/lib/simple_form/railtie.rb +4 -0
  9. data/lib/simple_form/version.rb +1 -1
  10. data/lib/simple_form/wrappers/leaf.rb +1 -1
  11. data/lib/simple_form.rb +8 -4
  12. metadata +5 -85
  13. data/test/action_view_extensions/builder_test.rb +0 -634
  14. data/test/action_view_extensions/form_helper_test.rb +0 -172
  15. data/test/components/custom_components_test.rb +0 -62
  16. data/test/components/label_test.rb +0 -352
  17. data/test/form_builder/association_test.rb +0 -252
  18. data/test/form_builder/button_test.rb +0 -48
  19. data/test/form_builder/error_notification_test.rb +0 -80
  20. data/test/form_builder/error_test.rb +0 -281
  21. data/test/form_builder/general_test.rb +0 -539
  22. data/test/form_builder/hint_test.rb +0 -150
  23. data/test/form_builder/input_field_test.rb +0 -195
  24. data/test/form_builder/label_test.rb +0 -136
  25. data/test/form_builder/wrapper_test.rb +0 -378
  26. data/test/generators/simple_form_generator_test.rb +0 -43
  27. data/test/inputs/boolean_input_test.rb +0 -256
  28. data/test/inputs/collection_check_boxes_input_test.rb +0 -323
  29. data/test/inputs/collection_radio_buttons_input_test.rb +0 -446
  30. data/test/inputs/collection_select_input_test.rb +0 -380
  31. data/test/inputs/color_input_test.rb +0 -10
  32. data/test/inputs/country_input_test.rb +0 -36
  33. data/test/inputs/datetime_input_test.rb +0 -176
  34. data/test/inputs/disabled_test.rb +0 -92
  35. data/test/inputs/discovery_test.rb +0 -142
  36. data/test/inputs/file_input_test.rb +0 -17
  37. data/test/inputs/general_test.rb +0 -133
  38. data/test/inputs/grouped_collection_select_input_test.rb +0 -196
  39. data/test/inputs/hidden_input_test.rb +0 -32
  40. data/test/inputs/numeric_input_test.rb +0 -177
  41. data/test/inputs/readonly_test.rb +0 -102
  42. data/test/inputs/required_test.rb +0 -158
  43. data/test/inputs/rich_text_area_input_test.rb +0 -15
  44. data/test/inputs/string_input_test.rb +0 -158
  45. data/test/inputs/text_input_test.rb +0 -37
  46. data/test/inputs/time_zone_input_test.rb +0 -36
  47. data/test/simple_form_test.rb +0 -18
  48. data/test/support/discovery_inputs.rb +0 -65
  49. data/test/support/misc_helpers.rb +0 -274
  50. data/test/support/mock_controller.rb +0 -30
  51. data/test/support/models.rb +0 -357
  52. data/test/test_helper.rb +0 -95
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ad9e2ec1c9f339ea03d225a1dc971adea0fb60efc571cd40655b7738eff273f
4
- data.tar.gz: 937cee947cb4432fea02ff967879356442721bed0e01cb0c4fa3e9f50626a2cb
3
+ metadata.gz: cfdcacda4f77b45f0a314651ceebcc8b55b7ad04292c947df7b8f7058b283b91
4
+ data.tar.gz: 0cf232b39ab76dc175f729024d35f55551c10a1bb7d391d9feeb5b2252f0fc48
5
5
  SHA512:
6
- metadata.gz: cf3e4b076014b076ff2168a0a1d236e21fbdf631ea0198d9e6a3b86eff908de1068f8a0f972fa7f4f9990ca3e3f7ae1d63a762b53f9975cebbd71e4f1a5a233e
7
- data.tar.gz: a0a12ac9760afd5ade06c4a26942adbe515570947b0ae1eb7889fb0d626e2e57b177e82e32a02346ec0fe23591ce74cd609f669892df0d9969ae8b858562ec91
6
+ metadata.gz: c567585213251a013e64188da22598a980451d68fc96d8b9a7eb8f937b2b8d7fef6659d9213133728070c11d9e1ab8f647960cba60a9516b0805d6effcf07dac
7
+ data.tar.gz: 6912ab15c194e3090b27b9331fd8f3db7402ba64e286c8165b816aa8ee7c7fea4c285b1e8df09ccfb2daaeb51393156df6369df6b4c52b13548c00e498c53494
data/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  ## Unreleased
2
2
 
3
3
 
4
+
5
+ ## 5.3.1
6
+
7
+ * Revert "Speed up input mapping lookup by avoiding rescuing exceptions" from v5.3.0, it caused a regression on dev/test environments with custom inputs.
8
+ * Try a slightly different approach to input lookups, without relying on regexp, to see if that helps with performance as originally intended.
9
+ * Add support to Ruby 3.3. (no changes required.)
10
+
11
+ ## 5.3.0
12
+
13
+ * Add support for Rails 7.1. (no meaningful changes required.)
14
+ * Add `SimpleForm.deprecator` to integrate with new application deprecators in Rails 7.1.
15
+ * Remove test files from the gem package. [@orien](https://github.com/orien)
16
+ * Speed up input mapping lookup by avoiding rescuing exceptions. [@meanphil](https://github.com/meanphil) [@kriom](https://github.com/kriom) [@egeek](https://github.com/egeek)
17
+
4
18
  ## 5.2.0
5
19
 
6
20
  * Add support for Rails 7.0 and Ruby 3.1/3.2 (no changes required)
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020 Rafael França, Carlos Antônio da Silva
1
+ Copyright (c) 2020-2024 Rafael França, Carlos Antônio da Silva
2
2
  Copyright (c) 2009-2019 Plataformatec
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![Simple Form Logo](https://raw.github.com/heartcombo/simple_form/master/simple_form.png)
1
+ ![Simple Form Logo](https://raw.github.com/heartcombo/simple_form/main/simple_form.png)
2
2
 
3
3
  Rails forms made easy.
4
4
 
@@ -262,7 +262,7 @@ the wrapper as well:
262
262
  <% end %>
263
263
  ```
264
264
 
265
- By default, **Simple Form** generates a hidden field to handle the un-checked case for boolean fields.
265
+ By default, **Simple Form** generates a hidden field to handle the un-checked case for boolean fields.
266
266
  Passing `unchecked_value: false` in the options for boolean fields will cause this hidden field to be omitted,
267
267
  following the convention in Rails. You can also specify `include_hidden: false` to skip the hidden field:
268
268
 
@@ -1289,11 +1289,10 @@ If you have discovered a security related bug, please do NOT use the GitHub issu
1289
1289
  * Felipe Renan (https://github.com/feliperenan)
1290
1290
 
1291
1291
  [![Gem Version](https://fury-badge.herokuapp.com/rb/simple_form.png)](http://badge.fury.io/rb/simple_form)
1292
- [![Code Climate](https://codeclimate.com/github/heartcombo/simple_form.png)](https://codeclimate.com/github/heartcombo/simple_form)
1293
1292
  [![Inline docs](http://inch-ci.org/github/heartcombo/simple_form.png)](http://inch-ci.org/github/heartcombo/simple_form)
1294
1293
 
1295
1294
  ## License
1296
1295
 
1297
- MIT License. Copyright 2020 Rafael França, Carlos Antônio da Silva. Copyright 2009-2019 Plataformatec.
1296
+ MIT License. Copyright 2020-2024 Rafael França, Carlos Antônio da Silva. Copyright 2009-2019 Plataformatec.
1298
1297
 
1299
1298
  The Simple Form logo is licensed under [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License](https://creativecommons.org/licenses/by-nc-nd/4.0/).
@@ -11,7 +11,7 @@ module SimpleForm
11
11
  end
12
12
 
13
13
  def has_errors?
14
- object_with_errors? || object.nil? && has_custom_error?
14
+ object_with_errors? || !object && has_custom_error?
15
15
  end
16
16
 
17
17
  def has_value?
@@ -22,7 +22,7 @@ module SimpleForm
22
22
  method = method(namespace)
23
23
 
24
24
  if method.arity.zero?
25
- ActiveSupport::Deprecation.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: namespace })
25
+ SimpleForm.deprecator.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: namespace })
26
26
 
27
27
  method.call
28
28
  else
@@ -676,7 +676,7 @@ module SimpleForm
676
676
  begin
677
677
  at.const_get(mapping)
678
678
  rescue NameError => e
679
- raise if e.message !~ /#{mapping}$/
679
+ raise unless e.message.include?(mapping)
680
680
  end
681
681
  end
682
682
 
@@ -11,5 +11,9 @@ module SimpleForm
11
11
  ' Use `rails generate simple_form:install` to generate the Simple Form configuration.'
12
12
  end
13
13
  end
14
+
15
+ initializer "simple_form.deprecator" do |app|
16
+ app.deprecators[:simple_form] = SimpleForm.deprecator if app.respond_to?(:deprecators)
17
+ end
14
18
  end
15
19
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module SimpleForm
3
- VERSION = "5.2.0".freeze
3
+ VERSION = "5.3.1".freeze
4
4
  end
@@ -13,7 +13,7 @@ module SimpleForm
13
13
  method = input.method(@namespace)
14
14
 
15
15
  if method.arity.zero?
16
- ActiveSupport::Deprecation.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: @namespace })
16
+ SimpleForm.deprecator.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: @namespace })
17
17
 
18
18
  method.call
19
19
  else
data/lib/simple_form.rb CHANGED
@@ -55,6 +55,10 @@ See http://blog.plataformatec.com.br/2019/09/incorrect-access-control-in-simple-
55
55
  @@configured
56
56
  end
57
57
 
58
+ def self.deprecator
59
+ @deprecator ||= ActiveSupport::Deprecation.new("5.3", "SimpleForm")
60
+ end
61
+
58
62
  ## CONFIGURATION OPTIONS
59
63
 
60
64
  # Method used to tidy up errors.
@@ -264,21 +268,21 @@ See http://blog.plataformatec.com.br/2019/09/incorrect-access-control-in-simple-
264
268
  ## SETUP
265
269
 
266
270
  def self.default_input_size=(*)
267
- ActiveSupport::Deprecation.warn "[SIMPLE_FORM] SimpleForm.default_input_size= is deprecated and has no effect", caller
271
+ SimpleForm.deprecator.warn "[SIMPLE_FORM] SimpleForm.default_input_size= is deprecated and has no effect", caller
268
272
  end
269
273
 
270
274
  def self.form_class=(value)
271
- ActiveSupport::Deprecation.warn "[SIMPLE_FORM] SimpleForm.form_class= is deprecated and will be removed in 4.x. Use SimpleForm.default_form_class= instead", caller
275
+ SimpleForm.deprecator.warn "[SIMPLE_FORM] SimpleForm.form_class= is deprecated and will be removed in 4.x. Use SimpleForm.default_form_class= instead", caller
272
276
  @@form_class = value
273
277
  end
274
278
 
275
279
  def self.file_methods=(file_methods)
276
- ActiveSupport::Deprecation.warn(FILE_METHODS_DEPRECATION_WARN, caller)
280
+ SimpleForm.deprecator.warn(FILE_METHODS_DEPRECATION_WARN, caller)
277
281
  @@file_methods = file_methods
278
282
  end
279
283
 
280
284
  def self.file_methods
281
- ActiveSupport::Deprecation.warn(FILE_METHODS_DEPRECATION_WARN, caller)
285
+ SimpleForm.deprecator.warn(FILE_METHODS_DEPRECATION_WARN, caller)
282
286
  @@file_methods
283
287
  end
284
288
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 5.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - José Valim
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-01-29 00:00:00.000000000 Z
13
+ date: 2024-05-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel
@@ -112,53 +112,13 @@ files:
112
112
  - lib/simple_form/wrappers/many.rb
113
113
  - lib/simple_form/wrappers/root.rb
114
114
  - lib/simple_form/wrappers/single.rb
115
- - test/action_view_extensions/builder_test.rb
116
- - test/action_view_extensions/form_helper_test.rb
117
- - test/components/custom_components_test.rb
118
- - test/components/label_test.rb
119
- - test/form_builder/association_test.rb
120
- - test/form_builder/button_test.rb
121
- - test/form_builder/error_notification_test.rb
122
- - test/form_builder/error_test.rb
123
- - test/form_builder/general_test.rb
124
- - test/form_builder/hint_test.rb
125
- - test/form_builder/input_field_test.rb
126
- - test/form_builder/label_test.rb
127
- - test/form_builder/wrapper_test.rb
128
- - test/generators/simple_form_generator_test.rb
129
- - test/inputs/boolean_input_test.rb
130
- - test/inputs/collection_check_boxes_input_test.rb
131
- - test/inputs/collection_radio_buttons_input_test.rb
132
- - test/inputs/collection_select_input_test.rb
133
- - test/inputs/color_input_test.rb
134
- - test/inputs/country_input_test.rb
135
- - test/inputs/datetime_input_test.rb
136
- - test/inputs/disabled_test.rb
137
- - test/inputs/discovery_test.rb
138
- - test/inputs/file_input_test.rb
139
- - test/inputs/general_test.rb
140
- - test/inputs/grouped_collection_select_input_test.rb
141
- - test/inputs/hidden_input_test.rb
142
- - test/inputs/numeric_input_test.rb
143
- - test/inputs/readonly_test.rb
144
- - test/inputs/required_test.rb
145
- - test/inputs/rich_text_area_input_test.rb
146
- - test/inputs/string_input_test.rb
147
- - test/inputs/text_input_test.rb
148
- - test/inputs/time_zone_input_test.rb
149
- - test/simple_form_test.rb
150
- - test/support/discovery_inputs.rb
151
- - test/support/misc_helpers.rb
152
- - test/support/mock_controller.rb
153
- - test/support/models.rb
154
- - test/test_helper.rb
155
115
  homepage: https://github.com/heartcombo/simple_form
156
116
  licenses:
157
117
  - MIT
158
118
  metadata:
159
119
  homepage_uri: https://github.com/heartcombo/simple_form
160
120
  documentation_uri: https://rubydoc.info/github/heartcombo/simple_form
161
- changelog_uri: https://github.com/heartcombo/simple_form/blob/master/CHANGELOG.md
121
+ changelog_uri: https://github.com/heartcombo/simple_form/blob/main/CHANGELOG.md
162
122
  source_code_uri: https://github.com/heartcombo/simple_form
163
123
  bug_tracker_uri: https://github.com/heartcombo/simple_form/issues
164
124
  wiki_uri: https://github.com/heartcombo/simple_form/wiki
@@ -177,48 +137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
137
  - !ruby/object:Gem::Version
178
138
  version: '0'
179
139
  requirements: []
180
- rubygems_version: 3.4.5
140
+ rubygems_version: 3.3.27
181
141
  signing_key:
182
142
  specification_version: 4
183
143
  summary: Forms made easy!
184
- test_files:
185
- - test/action_view_extensions/builder_test.rb
186
- - test/action_view_extensions/form_helper_test.rb
187
- - test/components/custom_components_test.rb
188
- - test/components/label_test.rb
189
- - test/form_builder/association_test.rb
190
- - test/form_builder/button_test.rb
191
- - test/form_builder/error_notification_test.rb
192
- - test/form_builder/error_test.rb
193
- - test/form_builder/general_test.rb
194
- - test/form_builder/hint_test.rb
195
- - test/form_builder/input_field_test.rb
196
- - test/form_builder/label_test.rb
197
- - test/form_builder/wrapper_test.rb
198
- - test/generators/simple_form_generator_test.rb
199
- - test/inputs/boolean_input_test.rb
200
- - test/inputs/collection_check_boxes_input_test.rb
201
- - test/inputs/collection_radio_buttons_input_test.rb
202
- - test/inputs/collection_select_input_test.rb
203
- - test/inputs/color_input_test.rb
204
- - test/inputs/country_input_test.rb
205
- - test/inputs/datetime_input_test.rb
206
- - test/inputs/disabled_test.rb
207
- - test/inputs/discovery_test.rb
208
- - test/inputs/file_input_test.rb
209
- - test/inputs/general_test.rb
210
- - test/inputs/grouped_collection_select_input_test.rb
211
- - test/inputs/hidden_input_test.rb
212
- - test/inputs/numeric_input_test.rb
213
- - test/inputs/readonly_test.rb
214
- - test/inputs/required_test.rb
215
- - test/inputs/rich_text_area_input_test.rb
216
- - test/inputs/string_input_test.rb
217
- - test/inputs/text_input_test.rb
218
- - test/inputs/time_zone_input_test.rb
219
- - test/simple_form_test.rb
220
- - test/support/discovery_inputs.rb
221
- - test/support/misc_helpers.rb
222
- - test/support/mock_controller.rb
223
- - test/support/models.rb
224
- - test/test_helper.rb
144
+ test_files: []