formatic 0.3.0 → 0.4.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: 6e76d4fb54356f3c1617b84931834bb46e25dbdb8b9923d5449452c72a43fff5
4
- data.tar.gz: aa825faad29917f0aaf406e849d50c4b202613d1853927e3d2236488e8a767c2
3
+ metadata.gz: 2e8931dc635b9f82d078e614fe974173add25c068d5269c28531fe947c3be596
4
+ data.tar.gz: e73abb6b3045ca45d0546a17967e60f6aec03489a48381240447a3e0a3d63bc4
5
5
  SHA512:
6
- metadata.gz: 1da9feda2b01a0e4154db1b2efb67904abf8a799c0c518caa83d135edb283e3b534342734acb2a24cf1fadb317e8cc09ecf7c802ee99c475caa339642a2e2fe8
7
- data.tar.gz: d95a0967fe128dc408d3dd67e4ffc984b65b0b75362ed6b0b3e92bbde94d0fe61506b77bea87a1a5e79637824e96aa949a29f28cd8ff876f143653002674bced
6
+ metadata.gz: e4e0ec1a1dc71da29321efee225c7a3ca3aa4dc4fd15bd885ff8d80a0e903cd62879ddd5078d742e9ca9a66a2efb1517db0b3855dc8ef2ac843fa51d145abe81
7
+ data.tar.gz: 6bd89feb80068a835b453ef11af4df9635f3094347f090c45f3e21b3029f7f3b44dbe52b1ceebbf403a664d5b8f942d86f1f09493eabaf129f1d1b55f053a048
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.4.0] 2026-08-05
2
+
3
+ - `Formatic::File` now raises at render time when `attribute_name` does not exist on the model, so typos like `header_logo_for_light` (instead of the model's `header_logo_for_dark`) surface immediately instead of silently dropping the upload. The check is skipped when a manual `value:` is passed, the form builder has no object, or the object is not an ActiveModel/ActiveRecord record.
4
+
1
5
  ## [0.3.0] 2026-08-04
2
6
 
3
7
  - Make VS Code snippet symlinking atomic so concurrent app boots no longer race into `Errno::EEXIST`
@@ -42,8 +42,27 @@ module Formatic
42
42
  { entries: entries_json }.merge(manual_data)
43
43
  end
44
44
 
45
+ def before_render
46
+ validate_attribute_name!
47
+ end
48
+
45
49
  private
46
50
 
51
+ def validate_attribute_name!
52
+ # A manually passed value means `attribute_name` is just a param name,
53
+ # not necessarily a method on the model.
54
+ return if manual_value != :_fetch_from_record
55
+ return if f.nil? || f.object.nil?
56
+
57
+ # Only enforce this for real ActiveModel/ActiveRecord records.
58
+ # Custom objects (e.g. slugs) are not expected to respond to it.
59
+ return unless f.object.respond_to?(:model_name)
60
+ return if f.object.respond_to?(attribute_name)
61
+
62
+ raise ArgumentError,
63
+ "attribute `#{attribute_name}` does not exist on #{f.object.class}."
64
+ end
65
+
47
66
  def attachments
48
67
  return [] if value.blank?
49
68
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Formatic
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - halo