svelte-on-rails 18.5.1 → 18.5.2

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: 3ed621dde718bf8eceeddea717554e0ea3cf3d5e5bb4e08054febf54fdc05dc1
4
- data.tar.gz: c37df696752b3131d1b6e052bfd69cc9dfdc8fc96d499826adf75accd11e1629
3
+ metadata.gz: 9d8a65dff2f84dcd6d82a91fafbaf9f1e3d0fc97f905f9d9d2903e26a71a1ea2
4
+ data.tar.gz: af1d450db5e8d345154a67edcf3a9704efa57804ef7fd6fa366b1341fefee428
5
5
  SHA512:
6
- metadata.gz: ca94ca36d2c72df70fc17b2a50bdf286e0b5e48c687af32063c13b240e96da845160297c0fc5eb6e43c908a60e547751bad44ad28a78b19744ab246c1149621d
7
- data.tar.gz: 11d15a1c504f82b246f8e4119813b52d6e3b337a4b731b20d887ab1d8386806b52a2d8532166dfea46ec1fa1be62c9491a58ab39ae34398ab14a3d60ab916623
6
+ metadata.gz: 955fcdbe77682d959084b6be548a02f0635839f202698b5bbff6b76b8e021914594036a21d703983cb3fe78445b12e2a3587f7fe42b18582a330f330ffc961bb
7
+ data.tar.gz: d1aac0db9a2e77c6b7f3427c1a29a52fca1e3b115cbf7822d6500b84745ff4acf6fbd281c59c23c3c5ecc9b19c281839c6ec0ec39515476864392fc69cc28cbb
@@ -66,12 +66,21 @@ module SvelteOnRails
66
66
  mn = model.model_name
67
67
  {
68
68
  'humanName' => mn.human,
69
- 'humanNamePlural' => mn.human(count: :many),
69
+ 'humanNamePlural' => human_name_plural(mn, model),
70
70
  'paramKey' => mn.param_key,
71
71
  'routeKey' => mn.route_key,
72
72
  }
73
73
  end
74
74
 
75
+ def human_name_plural(mn, model)
76
+ mn.human(count: :many)
77
+ rescue StandardError => e
78
+ Rails.logger.warn(
79
+ "[svelte-on-rails] #{model.name}.model_name.human(count: :many) failed:\n#{e.class}: #{e.message}\nFallback to human_name (singular)."
80
+ )
81
+ "#{model.name}.model_name.human(count: :many) failed"
82
+ end
83
+
75
84
  def column_attributes(model, attr)
76
85
 
77
86
  attr_s = attr.to_s
@@ -49,7 +49,6 @@ turbo_stream:
49
49
  # html-id of any element that must exist for being able to receive actions (turbo streams can only work this way)
50
50
  channel: 'public'
51
51
 
52
-
53
52
  to_svelte_props:
54
53
  translations:
55
54
  helpers:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svelte-on-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 18.5.1
4
+ version: 18.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Sedlmair