bard-attachment_field 0.5.4 → 0.5.5

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: ce6c35b5100e96423e481bdb7cb16685dd12eb13fd2712f0aa6e0018193a75e8
4
- data.tar.gz: 70a5d3a46439faabb9588ec04655f92092bd94c357ec5b492b56bf1376621d64
3
+ metadata.gz: 2733d25acbfd090219ca9d4b052dbb0de909d09ca6a40e6bd73a8cffc6592624
4
+ data.tar.gz: a7353e23c5320f82e53bbab05f5c0d2c4e671015006f6e44752a18bd51f6e1b0
5
5
  SHA512:
6
- metadata.gz: 6f73d93cd92298b236646d0bbe72d54bccfe8490fe0bc8dc2dc0e46512afaecca53e6fb44ff4ab4ebb6a2343483afc17fba84171d392ff9981bb0e5ebd1ae4e5
7
- data.tar.gz: 78ecf96abad31aaebf81a9a4d0cc8073a8a565ead77cd6c0406d95bb34b0b05371fb1711db616079969ca437ef6cb72b8039c5fef99f15c15e14e5d6a3af0ae1
6
+ metadata.gz: 733d951e0101860ee62df8cb677286a54d0f2de1fcde4ada547617c43a8d2b58e8ef8879ec998a317054b7b20e604b5027bc00dc15081feb4c73b10e2e0d4530
7
+ data.tar.gz: 1bcd82fcf146a89e3d16d827b2b3746e5ba5dc244d81777fede20ffa9882acb5ba6a49e5d19e45678c63837365cf04bbee671b1b68fbd8f40ea6be0575ec1e8c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.5] - 2026-06-06
4
+
5
+ ### Bug Fixes
6
+
7
+ - Capture the block passed to `attachment_field` instead of using its return
8
+ value. Previously the block's markup leaked to the surrounding output buffer,
9
+ leaving `<input-attachment>` with no `<attachment-file>` child — so editing a
10
+ record and saving without touching the file submitted an empty value and
11
+ silently purged the existing attachment.
12
+
3
13
  ## [0.2.0] - 2026-03-03
4
14
 
5
15
  ### Features
@@ -8,8 +8,12 @@ module Bard
8
8
  })
9
9
  add_default_name_and_id(options)
10
10
 
11
- content_tag("input-attachment", options) do
12
- next block.call(options) if block
11
+ content = if block
12
+ # Capture the template block's rendered markup. Using block.call would
13
+ # return the block's value while its markup leaked to the surrounding
14
+ # output buffer, leaving <input-attachment> childless (see BARD #262849).
15
+ @template_object.capture(options, &block)
16
+ else
13
17
  Array(object.try(@method_name)).map do |attachment|
14
18
  content_tag("attachment-file", nil, {
15
19
  name: options["name"],
@@ -20,6 +24,8 @@ module Bard
20
24
  })
21
25
  end.join("\n").html_safe
22
26
  end
27
+
28
+ content_tag("input-attachment", content, options)
23
29
  end
24
30
 
25
31
  private
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bard
4
4
  module AttachmentField
5
- VERSION = "0.5.4"
5
+ VERSION = "0.5.5"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard-attachment_field
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-05-30 00:00:00.000000000 Z
11
+ date: 2026-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage