formtastic 4.0.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +13 -13
  3. data/CHANGELOG.md +10 -1
  4. data/Gemfile.lock +99 -64
  5. data/README.md +7 -2
  6. data/formtastic.gemspec +5 -3
  7. data/gemfiles/{rails_5.2 → rails_7.0}/Gemfile +1 -1
  8. data/gemfiles/rails_7.1/Gemfile +5 -0
  9. data/gemfiles/rails_edge/Gemfile +1 -1
  10. data/lib/formtastic/action_class_finder.rb +1 -0
  11. data/lib/formtastic/actions/base.rb +1 -0
  12. data/lib/formtastic/actions/button_action.rb +1 -0
  13. data/lib/formtastic/actions/buttonish.rb +1 -0
  14. data/lib/formtastic/actions/input_action.rb +1 -0
  15. data/lib/formtastic/actions/link_action.rb +1 -0
  16. data/lib/formtastic/actions.rb +1 -0
  17. data/lib/formtastic/deprecation.rb +2 -1
  18. data/lib/formtastic/engine.rb +1 -0
  19. data/lib/formtastic/form_builder.rb +1 -0
  20. data/lib/formtastic/helpers/action_helper.rb +1 -0
  21. data/lib/formtastic/helpers/actions_helper.rb +1 -0
  22. data/lib/formtastic/helpers/enum.rb +1 -0
  23. data/lib/formtastic/helpers/errors_helper.rb +1 -0
  24. data/lib/formtastic/helpers/fieldset_wrapper.rb +1 -0
  25. data/lib/formtastic/helpers/file_column_detection.rb +1 -0
  26. data/lib/formtastic/helpers/form_helper.rb +1 -0
  27. data/lib/formtastic/helpers/input_helper.rb +2 -4
  28. data/lib/formtastic/helpers/inputs_helper.rb +2 -1
  29. data/lib/formtastic/helpers/reflection.rb +1 -0
  30. data/lib/formtastic/helpers.rb +1 -1
  31. data/lib/formtastic/html_attributes.rb +1 -0
  32. data/lib/formtastic/i18n.rb +1 -0
  33. data/lib/formtastic/input_class_finder.rb +1 -0
  34. data/lib/formtastic/inputs/base/associations.rb +1 -0
  35. data/lib/formtastic/inputs/base/choices.rb +2 -1
  36. data/lib/formtastic/inputs/base/collections.rb +4 -1
  37. data/lib/formtastic/inputs/base/database.rb +5 -7
  38. data/lib/formtastic/inputs/base/datetime_pickerish.rb +1 -0
  39. data/lib/formtastic/inputs/base/errors.rb +3 -2
  40. data/lib/formtastic/inputs/base/fileish.rb +1 -0
  41. data/lib/formtastic/inputs/base/hints.rb +1 -0
  42. data/lib/formtastic/inputs/base/html.rb +2 -1
  43. data/lib/formtastic/inputs/base/labelling.rb +3 -2
  44. data/lib/formtastic/inputs/base/naming.rb +1 -0
  45. data/lib/formtastic/inputs/base/numeric.rb +1 -0
  46. data/lib/formtastic/inputs/base/options.rb +1 -0
  47. data/lib/formtastic/inputs/base/placeholder.rb +1 -0
  48. data/lib/formtastic/inputs/base/stringish.rb +1 -0
  49. data/lib/formtastic/inputs/base/timeish.rb +4 -3
  50. data/lib/formtastic/inputs/base/validations.rb +2 -1
  51. data/lib/formtastic/inputs/base/wrapping.rb +1 -0
  52. data/lib/formtastic/inputs/base.rb +3 -2
  53. data/lib/formtastic/inputs/boolean_input.rb +2 -1
  54. data/lib/formtastic/inputs/check_boxes_input.rb +2 -1
  55. data/lib/formtastic/inputs/color_input.rb +1 -0
  56. data/lib/formtastic/inputs/country_input.rb +1 -0
  57. data/lib/formtastic/inputs/datalist_input.rb +1 -0
  58. data/lib/formtastic/inputs/date_picker_input.rb +1 -0
  59. data/lib/formtastic/inputs/date_select_input.rb +1 -0
  60. data/lib/formtastic/inputs/datetime_picker_input.rb +1 -0
  61. data/lib/formtastic/inputs/datetime_select_input.rb +1 -0
  62. data/lib/formtastic/inputs/email_input.rb +1 -0
  63. data/lib/formtastic/inputs/file_input.rb +1 -0
  64. data/lib/formtastic/inputs/hidden_input.rb +3 -2
  65. data/lib/formtastic/inputs/number_input.rb +1 -0
  66. data/lib/formtastic/inputs/password_input.rb +1 -0
  67. data/lib/formtastic/inputs/phone_input.rb +1 -0
  68. data/lib/formtastic/inputs/radio_input.rb +1 -0
  69. data/lib/formtastic/inputs/range_input.rb +1 -0
  70. data/lib/formtastic/inputs/search_input.rb +1 -0
  71. data/lib/formtastic/inputs/select_input.rb +1 -0
  72. data/lib/formtastic/inputs/string_input.rb +1 -0
  73. data/lib/formtastic/inputs/text_input.rb +1 -0
  74. data/lib/formtastic/inputs/time_picker_input.rb +1 -0
  75. data/lib/formtastic/inputs/time_select_input.rb +1 -0
  76. data/lib/formtastic/inputs/time_zone_input.rb +1 -0
  77. data/lib/formtastic/inputs/url_input.rb +1 -0
  78. data/lib/formtastic/inputs.rb +1 -0
  79. data/lib/formtastic/localized_string.rb +1 -0
  80. data/lib/formtastic/localizer.rb +1 -0
  81. data/lib/formtastic/namespaced_class_finder.rb +7 -8
  82. data/lib/formtastic/version.rb +2 -1
  83. data/lib/formtastic.rb +1 -0
  84. data/lib/generators/formtastic/form/form_generator.rb +1 -0
  85. data/lib/generators/formtastic/input/input_generator.rb +1 -0
  86. data/lib/generators/formtastic/install/install_generator.rb +1 -0
  87. data/lib/generators/templates/formtastic.rb +1 -0
  88. data/script/integration-template.rb +2 -3
  89. data/spec/action_class_finder_spec.rb +1 -0
  90. data/spec/actions/button_action_spec.rb +17 -16
  91. data/spec/actions/generic_action_spec.rb +130 -129
  92. data/spec/actions/input_action_spec.rb +16 -15
  93. data/spec/actions/link_action_spec.rb +25 -24
  94. data/spec/builder/custom_builder_spec.rb +5 -4
  95. data/spec/builder/error_proc_spec.rb +2 -1
  96. data/spec/builder/semantic_fields_for_spec.rb +26 -25
  97. data/spec/fast_spec_helper.rb +1 -0
  98. data/spec/generators/formtastic/form/form_generator_spec.rb +8 -7
  99. data/spec/generators/formtastic/input/input_generator_spec.rb +1 -0
  100. data/spec/generators/formtastic/install/install_generator_spec.rb +1 -0
  101. data/spec/helpers/action_helper_spec.rb +15 -14
  102. data/spec/helpers/actions_helper_spec.rb +42 -41
  103. data/spec/helpers/form_helper_spec.rb +26 -19
  104. data/spec/helpers/input_helper_spec.rb +70 -69
  105. data/spec/helpers/inputs_helper_spec.rb +179 -179
  106. data/spec/helpers/reflection_helper_spec.rb +4 -3
  107. data/spec/helpers/semantic_errors_helper_spec.rb +4 -3
  108. data/spec/i18n_spec.rb +13 -12
  109. data/spec/input_class_finder_spec.rb +1 -0
  110. data/spec/inputs/base/collections_spec.rb +2 -0
  111. data/spec/inputs/base/validations_spec.rb +1 -0
  112. data/spec/inputs/boolean_input_spec.rb +66 -65
  113. data/spec/inputs/check_boxes_input_spec.rb +89 -88
  114. data/spec/inputs/color_input_spec.rb +7 -6
  115. data/spec/inputs/country_input_spec.rb +10 -9
  116. data/spec/inputs/custom_input_spec.rb +1 -0
  117. data/spec/inputs/datalist_input_spec.rb +2 -1
  118. data/spec/inputs/date_picker_input_spec.rb +109 -108
  119. data/spec/inputs/date_select_input_spec.rb +63 -62
  120. data/spec/inputs/datetime_picker_input_spec.rb +118 -117
  121. data/spec/inputs/datetime_select_input_spec.rb +72 -71
  122. data/spec/inputs/email_input_spec.rb +16 -15
  123. data/spec/inputs/file_input_spec.rb +17 -16
  124. data/spec/inputs/hidden_input_spec.rb +29 -28
  125. data/spec/inputs/include_blank_spec.rb +7 -6
  126. data/spec/inputs/label_spec.rb +25 -24
  127. data/spec/inputs/number_input_spec.rb +159 -158
  128. data/spec/inputs/password_input_spec.rb +16 -15
  129. data/spec/inputs/phone_input_spec.rb +16 -15
  130. data/spec/inputs/placeholder_spec.rb +17 -16
  131. data/spec/inputs/radio_input_spec.rb +58 -57
  132. data/spec/inputs/range_input_spec.rb +108 -107
  133. data/spec/inputs/readonly_spec.rb +5 -4
  134. data/spec/inputs/search_input_spec.rb +15 -14
  135. data/spec/inputs/select_input_spec.rb +144 -93
  136. data/spec/inputs/string_input_spec.rb +36 -35
  137. data/spec/inputs/text_input_spec.rb +32 -31
  138. data/spec/inputs/time_picker_input_spec.rb +110 -109
  139. data/spec/inputs/time_select_input_spec.rb +71 -70
  140. data/spec/inputs/time_zone_input_spec.rb +21 -20
  141. data/spec/inputs/url_input_spec.rb +16 -15
  142. data/spec/inputs/with_options_spec.rb +8 -7
  143. data/spec/localizer_spec.rb +1 -0
  144. data/spec/namespaced_class_finder_spec.rb +17 -5
  145. data/spec/schema.rb +1 -0
  146. data/spec/spec_helper.rb +8 -8
  147. data/spec/support/custom_macros.rb +64 -63
  148. data/spec/support/deprecation.rb +2 -1
  149. data/spec/support/shared_examples.rb +2 -1
  150. data/spec/support/specialized_class_finder_shared_example.rb +1 -0
  151. data/spec/support/test_environment.rb +1 -0
  152. metadata +29 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb44ea01df970135604cdddd0ac7b762ea56077f915810c4c8fe6be3487cafa3
4
- data.tar.gz: 18630a8282b76e40d0c6e9faad19f99112dfd9e22ba22e7b025d8730ebf26ace
3
+ metadata.gz: 70272678a1b436280de8d89add80583ca886cac153f6d4e43be93e6a641c344f
4
+ data.tar.gz: d2549407b0a3c5d21e7afe24cfd21bd008c9ca957bd06cf2d59fb7b3101fa042
5
5
  SHA512:
6
- metadata.gz: 73a3ad17e91765150e4e15e03d3031f5b9efd975a09bbb21c7f404709b7d2462e9cf16c708beaf2745b783def3a631ca1b3bd47278d79c16012d79ba1f549fc0
7
- data.tar.gz: d418a7e65f928dedfd36627c3ece7c4fe7e371984500ddc4bcb6c5929087264541476c469be6520270000a0e8348bc2cd41415e94d46c86da2e48021bf54d4be
6
+ metadata.gz: 4164b15cb0dc3eb5d2d90f257977d59b8459a1708f4520ba6ff1708eaf9dd898f2713d9f59945c1d50c2b481e2175c0e3d7af6259c9f1e715a836aac0dd0e53b
7
+ data.tar.gz: e93800c9ca16ea4afb445f5a95cb56e1dd0224f06654ef8af7b13dba8ddb4c520e09c4b49c760d10a7e71d6f381f9b6fb91bbe61e26e1cab83823c7e2dc827de
@@ -5,6 +5,11 @@ on:
5
5
  pull_request:
6
6
 
7
7
  jobs:
8
+ ci:
9
+ runs-on: ubuntu-latest
10
+ needs: test
11
+ steps:
12
+ - uses: actions/checkout@v2
8
13
  test:
9
14
  runs-on: ubuntu-20.04
10
15
 
@@ -13,31 +18,25 @@ jobs:
13
18
 
14
19
  matrix:
15
20
  gemfile:
16
- - gemfiles/rails_5.2/Gemfile
17
21
  - gemfiles/rails_6.0/Gemfile
18
22
  - gemfiles/rails_6.1/Gemfile
23
+ - gemfiles/rails_7.0/Gemfile
24
+ - gemfiles/rails_7.1/Gemfile
19
25
  - gemfiles/rails_edge/Gemfile
20
26
 
21
27
  ruby:
22
- - 2.4.10
23
- - 2.5.8
24
28
  - 2.6.6
25
29
  - 2.7.2
26
30
  - 3.0.0
27
31
 
28
32
  exclude:
29
- - ruby: 2.4.10
30
- gemfile: gemfiles/rails_6.0/Gemfile
31
-
32
- - ruby: 2.4.10
33
- gemfile: gemfiles/rails_6.1/Gemfile
34
-
35
- - ruby: 2.4.10
33
+ - ruby: 2.6.6
34
+ gemfile: gemfiles/rails_7.0/Gemfile
35
+ - ruby: 2.6.6
36
+ gemfile: gemfiles/rails_7.1/Gemfile
37
+ - ruby: 2.6.6
36
38
  gemfile: gemfiles/rails_edge/Gemfile
37
39
 
38
- - ruby: 3.0.0
39
- gemfile: gemfiles/rails_5.2/Gemfile
40
-
41
40
  env:
42
41
  BUNDLE_GEMFILE: ${{ matrix.gemfile }}
43
42
 
@@ -53,6 +52,7 @@ jobs:
53
52
  with:
54
53
  ruby-version: ${{ matrix.ruby }}
55
54
  bundler-cache: true
55
+ bundler: latest
56
56
 
57
57
  - name: Run tests
58
58
  run: |
data/CHANGELOG.md CHANGED
@@ -1,4 +1,13 @@
1
- ## master / 4.0.0
1
+ ## 5.0.0
2
+ * Added support for Rails 7.1 ([#1371](https://github.com/formtastic/formtastic/pull/1371))
3
+ * Removed support for Rails < 6.0.0 ([#1354](https://github.com/formtastic/formtastic/pull/1354))
4
+ * Removed support for Rubies < 2.6.0 ([#1332](https://github.com/formtastic/formtastic/pull/1332), [#1355](https://github.com/formtastic/formtastic.git/pull/1355))
5
+ * Added support for scopes in relations ([#1343](https://github.com/formtastic/formtastic/pull/1343))
6
+ * Fixed I18n lookup for enum values in nested select fields ([#1342](https://github.com/formtastic/formtastic/pull/1342))
7
+ * Fixed faster input class lookup ([#1336](https://github.com/formtastic/formtastic/pull/1336))
8
+ * Use frozen_string_literal internally ([#1339](https://github.com/formtastic/formtastic/pull/1339))
9
+
10
+ ## 4.0.0
2
11
  * Fixed default_columns_for_object when object has non-standard foreign keys (#1241)
3
12
  * Fixed missing constants in production (#911)
4
13
  * Removed support for Rails 3 and 4.0 (#1108)
data/Gemfile.lock CHANGED
@@ -1,93 +1,127 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- formtastic (4.0.0.rc1)
5
- actionpack (>= 5.2.0)
4
+ formtastic (4.0.0)
5
+ actionpack (>= 6.0.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionpack (6.1.1)
11
- actionview (= 6.1.1)
12
- activesupport (= 6.1.1)
13
- rack (~> 2.0, >= 2.0.9)
10
+ actionpack (7.1.1)
11
+ actionview (= 7.1.1)
12
+ activesupport (= 7.1.1)
13
+ nokogiri (>= 1.8.5)
14
+ rack (>= 2.2.4)
15
+ rack-session (>= 1.0.1)
14
16
  rack-test (>= 0.6.3)
15
- rails-dom-testing (~> 2.0)
16
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
17
- actionview (6.1.1)
18
- activesupport (= 6.1.1)
17
+ rails-dom-testing (~> 2.2)
18
+ rails-html-sanitizer (~> 1.6)
19
+ actionview (7.1.1)
20
+ activesupport (= 7.1.1)
19
21
  builder (~> 3.1)
20
- erubi (~> 1.4)
21
- rails-dom-testing (~> 2.0)
22
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
23
- activesupport (6.1.1)
22
+ erubi (~> 1.11)
23
+ rails-dom-testing (~> 2.2)
24
+ rails-html-sanitizer (~> 1.6)
25
+ activesupport (7.1.1)
26
+ base64
27
+ bigdecimal
24
28
  concurrent-ruby (~> 1.0, >= 1.0.2)
29
+ connection_pool (>= 2.2.5)
30
+ drb
25
31
  i18n (>= 1.6, < 2)
26
32
  minitest (>= 5.1)
33
+ mutex_m
27
34
  tzinfo (~> 2.0)
28
- zeitwerk (~> 2.3)
29
- ammeter (1.1.4)
35
+ ammeter (1.1.5)
30
36
  activesupport (>= 3.0)
31
37
  railties (>= 3.0)
32
38
  rspec-rails (>= 2.2)
39
+ base64 (0.1.1)
40
+ bigdecimal (3.1.4)
33
41
  builder (3.2.4)
34
- concurrent-ruby (1.1.8)
42
+ concurrent-ruby (1.2.2)
43
+ connection_pool (2.4.1)
35
44
  crass (1.0.6)
36
- diff-lcs (1.3)
37
- erubi (1.10.0)
38
- i18n (1.8.7)
45
+ diff-lcs (1.5.0)
46
+ drb (2.1.1)
47
+ ruby2_keywords
48
+ erubi (1.12.0)
49
+ i18n (1.14.1)
39
50
  concurrent-ruby (~> 1.0)
40
- loofah (2.9.0)
51
+ io-console (0.6.0)
52
+ irb (1.8.1)
53
+ rdoc
54
+ reline (>= 0.3.8)
55
+ loofah (2.21.4)
41
56
  crass (~> 1.0.2)
42
- nokogiri (>= 1.5.9)
43
- method_source (1.0.0)
44
- mini_portile2 (2.5.0)
45
- minitest (5.14.3)
46
- nokogiri (1.11.1)
47
- mini_portile2 (~> 2.5.0)
57
+ nokogiri (>= 1.12.0)
58
+ mini_portile2 (2.8.4)
59
+ minitest (5.20.0)
60
+ mutex_m (0.1.2)
61
+ nokogiri (1.15.4)
62
+ mini_portile2 (~> 2.8.2)
48
63
  racc (~> 1.4)
49
- racc (1.5.2)
50
- rack (2.2.3)
51
- rack-test (1.1.0)
52
- rack (>= 1.0, < 3)
53
- rails-dom-testing (2.0.3)
54
- activesupport (>= 4.2.0)
64
+ psych (5.1.1)
65
+ stringio
66
+ racc (1.7.1)
67
+ rack (3.0.8)
68
+ rack-session (2.0.0)
69
+ rack (>= 3.0.0)
70
+ rack-test (2.1.0)
71
+ rack (>= 1.3)
72
+ rackup (2.1.0)
73
+ rack (>= 3)
74
+ webrick (~> 1.8)
75
+ rails-dom-testing (2.2.0)
76
+ activesupport (>= 5.0.0)
77
+ minitest
55
78
  nokogiri (>= 1.6)
56
- rails-html-sanitizer (1.3.0)
57
- loofah (~> 2.3)
58
- railties (6.1.1)
59
- actionpack (= 6.1.1)
60
- activesupport (= 6.1.1)
61
- method_source
62
- rake (>= 0.8.7)
63
- thor (~> 1.0)
64
- rake (13.0.3)
65
- rspec-core (3.9.2)
66
- rspec-support (~> 3.9.3)
79
+ rails-html-sanitizer (1.6.0)
80
+ loofah (~> 2.21)
81
+ nokogiri (~> 1.14)
82
+ railties (7.1.1)
83
+ actionpack (= 7.1.1)
84
+ activesupport (= 7.1.1)
85
+ irb
86
+ rackup (>= 1.0.0)
87
+ rake (>= 12.2)
88
+ thor (~> 1.0, >= 1.2.2)
89
+ zeitwerk (~> 2.6)
90
+ rake (13.0.6)
91
+ rdoc (6.5.0)
92
+ psych (>= 4.0.0)
93
+ reline (0.3.9)
94
+ io-console (~> 0.5)
95
+ rspec-core (3.12.2)
96
+ rspec-support (~> 3.12.0)
67
97
  rspec-dom-testing (0.1.0)
68
98
  rails-dom-testing (>= 1.0, < 3)
69
99
  rspec-expectations (~> 3.0)
70
- rspec-expectations (3.9.2)
100
+ rspec-expectations (3.12.3)
71
101
  diff-lcs (>= 1.2.0, < 2.0)
72
- rspec-support (~> 3.9.0)
73
- rspec-mocks (3.9.1)
102
+ rspec-support (~> 3.12.0)
103
+ rspec-mocks (3.12.6)
74
104
  diff-lcs (>= 1.2.0, < 2.0)
75
- rspec-support (~> 3.9.0)
76
- rspec-rails (3.9.1)
77
- actionpack (>= 3.0)
78
- activesupport (>= 3.0)
79
- railties (>= 3.0)
80
- rspec-core (~> 3.9.0)
81
- rspec-expectations (~> 3.9.0)
82
- rspec-mocks (~> 3.9.0)
83
- rspec-support (~> 3.9.0)
84
- rspec-support (3.9.3)
85
- sqlite3 (1.4.2)
86
- thor (1.1.0)
87
- tzinfo (2.0.4)
105
+ rspec-support (~> 3.12.0)
106
+ rspec-rails (6.0.3)
107
+ actionpack (>= 6.1)
108
+ activesupport (>= 6.1)
109
+ railties (>= 6.1)
110
+ rspec-core (~> 3.12)
111
+ rspec-expectations (~> 3.12)
112
+ rspec-mocks (~> 3.12)
113
+ rspec-support (~> 3.12)
114
+ rspec-support (3.12.1)
115
+ ruby2_keywords (0.0.5)
116
+ sqlite3 (1.6.7)
117
+ mini_portile2 (~> 2.8.0)
118
+ stringio (3.0.8)
119
+ thor (1.2.2)
120
+ tzinfo (2.0.6)
88
121
  concurrent-ruby (~> 1.0)
89
- yard (0.9.25)
90
- zeitwerk (2.4.2)
122
+ webrick (1.8.1)
123
+ yard (0.9.34)
124
+ zeitwerk (2.6.12)
91
125
 
92
126
  PLATFORMS
93
127
  ruby
@@ -97,9 +131,10 @@ DEPENDENCIES
97
131
  formtastic!
98
132
  rake
99
133
  rspec-dom-testing (>= 0.1.0)
100
- rspec-rails (~> 3.4)
134
+ rspec-mocks (~> 3.12.2)
135
+ rspec-rails (>= 4.0)
101
136
  sqlite3 (~> 1.4)
102
137
  yard (~> 0.9.20)
103
138
 
104
139
  BUNDLED WITH
105
- 2.1.4
140
+ 2.3.18
data/README.md CHANGED
@@ -16,7 +16,8 @@ Formtastic is a Rails FormBuilder DSL (with some other goodies) to make it far e
16
16
 
17
17
  ## Compatibility
18
18
 
19
- * Formtastic 4 requires Rails 5.2 and Ruby 2.5 minimum
19
+ * Formtastic 5 requires Rails 6.0 and Ruby 2.6 minimum
20
+ * Formtastic 4 requires Rails 5.2 and Ruby 2.4 minimum
20
21
  * Formtastic 3 requires Rails 3.2.13 minimum
21
22
  * Formtastic 2 requires Rails 3
22
23
  * Formtastic, much like Rails, is very ActiveRecord-centric. Many are successfully using other ActiveModel-like ORMs and objects (DataMapper, MongoMapper, Mongoid, Authlogic, Devise...) but we're not guaranteeing full compatibility at this stage. Patches are welcome!
@@ -88,7 +89,7 @@ I also wrote the accompanying HTML output I expected, favoring something very si
88
89
  Simply add Formtastic to your Gemfile and bundle it up:
89
90
 
90
91
  ```ruby
91
- gem 'formtastic', '~> 4.0'
92
+ gem 'formtastic', '~> 5.0'
92
93
  ```
93
94
 
94
95
  Run the installation generator:
@@ -570,6 +571,10 @@ To create your own new types of inputs based on existing inputs, the process is
570
571
  def input_html_options
571
572
  super.merge(:class => "flexible-text-area")
572
573
  end
574
+
575
+ def options
576
+ super.merge(hint: 'This is a flexible text area')
577
+ end
573
578
  end
574
579
  ```
575
580
 
data/formtastic.gemspec CHANGED
@@ -21,14 +21,16 @@ Gem::Specification.new do |s|
21
21
  s.rdoc_options = ["--charset=UTF-8"]
22
22
  s.extra_rdoc_files = ["README.md"]
23
23
 
24
- s.required_ruby_version = '>= 2.4.0'
24
+ s.required_ruby_version = '>= 2.6.0'
25
25
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
26
26
  s.rubygems_version = %q{1.3.6}
27
27
 
28
- s.add_dependency(%q<actionpack>, [">= 5.2.0"])
28
+ s.add_dependency(%q<actionpack>, [">= 6.0.0"])
29
29
 
30
- s.add_development_dependency(%q<rspec-rails>, ["~> 3.4"])
30
+ s.add_development_dependency(%q<rspec-rails>, [">= 4.0"])
31
31
  s.add_development_dependency(%q<rspec-dom-testing>, [">= 0.1.0"])
32
+ s.add_development_dependency(%q<rspec-mocks>, ["~> 3.12.2"])
33
+
32
34
  s.add_development_dependency(%q<yard>, ["~> 0.9.20"])
33
35
  s.add_development_dependency(%q<ammeter>, ["~> 1.1.3"])
34
36
  s.add_development_dependency(%q<rake>)
@@ -1,5 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "rails", "~> 5.2.0"
3
+ gem "rails", "~> 7.0.0"
4
4
 
5
5
  gemspec path: "../.."
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~> 7.1.0"
4
+
5
+ gemspec path: "../.."
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "rails", git: "https://github.com/rails/rails.git"
3
+ gem "rails", git: "https://github.com/rails/rails.git", branch: "main"
4
4
  gem "rack", git: "https://github.com/rack/rack.git"
5
5
  gem "i18n", git: "https://github.com/svenfuchs/i18n.git"
6
6
  gem "arel", git: "https://github.com/rails/arel.git"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
 
3
4
  # Uses the {NamespacedClassFinder} to look up action class names.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Actions
3
4
  module Base
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Actions
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Actions
3
4
  module Buttonish
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Actions
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Actions
3
4
  # Outputs a link wrapped in the standard `<li>` wrapper. This the default for `:cancel` actions.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Actions
3
4
  extend ActiveSupport::Autoload
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
1
2
  require 'active_support/deprecation'
2
3
 
3
4
  module Formtastic
4
- Deprecation = ActiveSupport::Deprecation
5
+ Deprecation = ActiveSupport::Deprecation.new("5.0.0", "Formtastic")
5
6
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  # Required for formtastic.css to be discoverable in the asset pipeline
3
4
  # @private
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  class FormBuilder < ActionView::Helpers::FormBuilder
3
4
 
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  module Formtastic
3
4
  module Helpers
4
5
  module ActionHelper
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Helpers
3
4
  # ActionsHelper encapsulates the responsibilties of the {#actions} DSL for acting on
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Helpers
3
4
  # @private
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Helpers
3
4
  module ErrorsHelper
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Helpers
3
4
  # @private
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Helpers
3
4
  # @private
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Helpers
3
4
 
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  module Formtastic
3
4
  module Helpers
4
5
 
@@ -310,10 +311,7 @@ module Formtastic
310
311
  when @object.class.respond_to?(:column_for_attribute)
311
312
  @object.class.column_for_attribute(method)
312
313
  when @object.respond_to?(:column_for_attribute)
313
- # Remove deprecation wrapper & review after Rails 5.0 ships
314
- ActiveSupport::Deprecation.silence do
315
- @object.column_for_attribute(method)
316
- end
314
+ @object.column_for_attribute(method)
317
315
  else nil
318
316
  end
319
317
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Helpers
3
4
 
@@ -377,7 +378,7 @@ module Formtastic
377
378
  args << options.merge!(:parent => { :builder => self, :for => options[:for] })
378
379
 
379
380
  fields_for_block = if block_given?
380
- raise ArgumentError, 'You gave :for option with a block to inputs method, ' <<
381
+ raise ArgumentError, 'You gave :for option with a block to inputs method, ' +
381
382
  'but the block does not accept any argument.' if block.arity <= 0
382
383
  lambda do |f|
383
384
  contents = f.inputs(*args) do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Helpers
3
4
  # @private
@@ -1,6 +1,6 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Helpers
3
- autoload :ButtonsHelper, 'formtastic/helpers/buttons_helper'
4
4
  autoload :ActionHelper, 'formtastic/helpers/action_helper'
5
5
  autoload :ActionsHelper, 'formtastic/helpers/actions_helper'
6
6
  autoload :ErrorsHelper, 'formtastic/helpers/errors_helper'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  # @private
3
4
  module HtmlAttributes
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
2
3
 
3
4
  module Formtastic
4
5
  # @private
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
 
3
4
  # Uses the {Formtastic::NamespacedClassFinder} to look up input class names.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Inputs
3
4
  module Base
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Inputs
3
4
  module Base
@@ -92,7 +93,7 @@ module Formtastic
92
93
  label_html_options.merge(:class => "label")
93
94
  )
94
95
  else
95
- "".html_safe
96
+ +"".html_safe
96
97
  end
97
98
  end
98
99
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Inputs
3
4
  module Base
@@ -78,6 +79,8 @@ module Formtastic
78
79
  ) if reflection.options[:polymorphic] == true
79
80
  end
80
81
 
82
+ return reflection.klass.merge(reflection.scope) if reflection.scope
83
+
81
84
  conditions_from_reflection = (reflection.respond_to?(:options) && reflection.options[:conditions]) || {}
82
85
  conditions_from_reflection = conditions_from_reflection.call if conditions_from_reflection.is_a?(Proc)
83
86
 
@@ -114,7 +117,7 @@ module Formtastic
114
117
 
115
118
  enum_options_hash = object.defined_enums[method_name]
116
119
  enum_options_hash.map do |name, value|
117
- key = "activerecord.attributes.#{object_name}.#{method_name.pluralize}.#{name}"
120
+ key = "activerecord.attributes.#{object.model_name.i18n_key}.#{method_name.pluralize}.#{name}"
118
121
  label = ::I18n.translate(key, :default => name.humanize)
119
122
  [label, name]
120
123
  end
@@ -1,21 +1,19 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Inputs
3
4
  module Base
4
5
  module Database
5
-
6
+
6
7
  def column
7
8
  if object.respond_to?(:column_for_attribute)
8
- # Remove deprecation wrapper & review after Rails 5.0 ships
9
- ActiveSupport::Deprecation.silence do
10
- object.column_for_attribute(method)
11
- end
9
+ object.column_for_attribute(method)
12
10
  end
13
11
  end
14
-
12
+
15
13
  def column?
16
14
  !column.nil?
17
15
  end
18
-
16
+
19
17
  end
20
18
  end
21
19
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Inputs
3
4
  module Base
@@ -1,10 +1,11 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Inputs
3
4
  module Base
4
5
  module Errors
5
6
 
6
7
  def error_html
7
- errors? ? send(:"error_#{builder.inline_errors}_html") : ""
8
+ errors? ? send(:"error_#{builder.inline_errors}_html") : +""
8
9
  end
9
10
 
10
11
  def error_sentence_html
@@ -27,7 +28,7 @@ module Formtastic
27
28
  end
28
29
 
29
30
  def error_none_html
30
- ""
31
+ +""
31
32
  end
32
33
 
33
34
  def errors?
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Inputs
3
4
  module Base
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Formtastic
2
3
  module Inputs
3
4
  module Base