template_form 0.4.11 → 0.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a4bc1f34ec5b0859e85ef9f7498e7b046d6170efe43b1430f90f73236169465
4
- data.tar.gz: f565a7cd6a57955f54166187089ca8fd9b059c90aa040fc9e6d5ab3737e83e01
3
+ metadata.gz: 0b6cc4d9623f0173a4237d5ed8dde6cd97eae075ee9f32515f7b918ffc3d3519
4
+ data.tar.gz: a19f342f83d2618455a13768096da610d1938ecdfafdb4c6ff17eba3343d932e
5
5
  SHA512:
6
- metadata.gz: 12262a1cc6705af18da516bff6c04d3ab232c2cdc5c590c52c2a9944221ee4e91f997eed382226a6c90888e4035e5d637335554e2d8b05ead73bb1fe293b877b
7
- data.tar.gz: 28f0be6a652e070969a1610187894ffcc0db7bed86e70741e1db3d73915e566410426534f6f3e4b593642ef90ba6a1b87d98ef5875e9d01ed8b386f1dc73f6ae
6
+ metadata.gz: 7f276ed7c3c9dfba1922f3d61b76b31f7aad2480802c182abaad480cb82678b45640c4337aa8484340a66ba49939d46cee358276d23131a1565d5f652e0343ad
7
+ data.tar.gz: 8eb61ff35c92ecca35d05b69690765b7e1da03a2200f5227d5b8d029e6278a3d1941bfa46efe9c9be205c175ae3ebf0d566549549491e02b633494b7510f6617
@@ -16,14 +16,11 @@ module TemplateForm
16
16
 
17
17
  attr_reader :form_type
18
18
 
19
- def initialize(*)
19
+ def initialize(...)
20
20
  super
21
- # Do not remove `:form_type` from `options`. It has to stay so
22
- # when `fields_for()` instantiates a new form builder for each
23
- # associated record, the second and subsequent ones have the
24
- # correct form type.
25
- @form_type = options[:form_type] || TemplateForm.form_type
26
- @view = options[:view]
21
+ parent_options = options[:parent_builder]&.options
22
+ @form_type = options[:form_type] || parent_options&.dig(:form_type) || TemplateForm.form_type
23
+ @view = options[:view] || parent_options&.dig(:view)
27
24
  end
28
25
 
29
26
  def input(attribute_name, options = {})
@@ -56,6 +53,7 @@ module TemplateForm
56
53
  when :file then FileInput
57
54
  when :select then SelectInput
58
55
  when :grouped_select then GroupedSelectInput
56
+ else raise ArgumentError, "Unknown attribute type #{attribute_type}"
59
57
  end
60
58
  end
61
59
 
@@ -1,3 +1,3 @@
1
1
  module TemplateForm
2
- VERSION = "0.4.11"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: template_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.11
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Stewart
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-30 00:00:00.000000000 Z
11
+ date: 2026-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack