backstage 0.1.5 → 0.1.6

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: 302e4efe20bf1c65309c3383599db9d46a775a8ab3374f3949f5e56ff9179a2f
4
- data.tar.gz: 186490d4fd99db3b0878c628bd8e90295741fe3fe73920e1574a113865a0dc0f
3
+ metadata.gz: a513fd6ef88d9f48984caef85263fde67bfa98e2f9c297e77676f6db2e7d6960
4
+ data.tar.gz: d22cabffa69359f04fd6c2b0fe778498814f81b71a3b45f31414cc30ae681a22
5
5
  SHA512:
6
- metadata.gz: 1fb812d791a742f1d3dbaf65a766eb46e3a46028eded82bfbcfa8236d81035570995e21ad0e504f5421368e240b6342d8022dce9cf0f2f58b642223daf85659f
7
- data.tar.gz: 5ad2bd2bafca2ce45238986e5d2c78405109c4ac36f7266e4104574c812620677f778d750fa9629f87d26a52849bcd71cfe572dc1262552ae2e365bc58434dab
6
+ metadata.gz: 859b6c0f91970723b58c544722e36d772d9a5709ba350d7dafc21254c2bfd3f8db6e66c69d70b935fe632c623b8f18ada0480e9fee693c991de08aa9093490b0
7
+ data.tar.gz: a05307eaafa6d34474af2771d7b7d867297ffd95fd064d9319e742bfb41b7f038757bd82a35c8e27c3d864c5bdc154d0fe6c5dc601d18ddcb86a09ec821485d7
data/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.6] — 2026-05-19
11
+
12
+ ### Added
13
+
14
+ - `belongs_to` associations now render as a linked display name on the index page (e.g. "Alice" linking to the related record's edit page) instead of the raw foreign key integer
15
+
16
+ ### Fixed
17
+
18
+ - `AutoDiscovery#build` now assigns independent arrays to `index_fields` and `edit_fields`; previously they shared the same object, causing edits to one to silently affect the other
19
+
10
20
  ## [0.1.5] — 2026-05-19
11
21
 
12
22
  ### Fixed
@@ -34,6 +34,13 @@
34
34
  <td>
35
35
  <% if field.enum? %>
36
36
  <%= record.public_send(field.name).to_s.humanize %>
37
+ <% elsif field.belongs_to? %>
38
+ <% related = record.public_send(field.association.name)
39
+ col = field.association.display_column
40
+ label = related&.public_send(col) %>
41
+ <% if related %>
42
+ <%= link_to label, edit_resource_path(resource: related.class.model_name.plural, id: related.id) %>
43
+ <% end %>
37
44
  <% else %>
38
45
  <%= record.public_send(field.name) %>
39
46
  <% end %>
@@ -26,7 +26,7 @@ module Backstage
26
26
  config.display_column = detect_display_column
27
27
  fields = column_fields + enum_fields
28
28
  config.index_fields = fields
29
- config.edit_fields = fields
29
+ config.edit_fields = fields.dup
30
30
  config
31
31
  end
32
32
 
@@ -59,9 +59,11 @@ module Backstage
59
59
  assoc = AssociationConfig.new(name, :belongs_to, opts)
60
60
  @associations << assoc
61
61
  fk_field = Field.new(assoc.foreign_key, :belongs_to, association: assoc)
62
+ index_field = Field.new(name.to_sym, :belongs_to, association: assoc)
62
63
  @edit_fields.reject! { |f| f.name == fk_field.name }
63
- @index_fields.reject! { |f| f.name == fk_field.name }
64
+ @index_fields.reject! { |f| f.name == fk_field.name || f.name == index_field.name }
64
65
  @edit_fields << fk_field
66
+ @index_fields << index_field
65
67
  end
66
68
 
67
69
  def field(name, **opts)
@@ -1,3 +1,3 @@
1
1
  module Backstage
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backstage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gareth James
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-19 00:00:00.000000000 Z
11
+ date: 2026-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties