Skip to content

feat: link belongs_to foreign keys to the related record - #447

Open
etiennelacoursiere wants to merge 1 commit into
ash-project:mainfrom
rum-and-code:feat/relationship-links
Open

etiennelacoursiere wants to merge 1 commit into
ash-project:mainfrom
rum-and-code:feat/relationship-links

Conversation

@etiennelacoursiere

Copy link
Copy Markdown
Contributor

Foreign key attributes of belongs_to relationships (e.g. user_id) now render as links to the related record's show page, on the show page and in the data tables. A link is only rendered when the destination resource is visible in this admin (its domain is shown, the resource is listed, and it has a show action), so it never falls through to the wrong domain.

The behaviour can be turned off per resource with the new link_relationships? admin option (defaults to true).

The "Show" button on has_one/belongs_to relationship panels uses the same visibility check.

image

Contributor checklist

Leave anything that you believe does not apply unchecked.

  • I accept the AI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

Foreign key attributes of `belongs_to` relationships (e.g. `user_id`) now
render as links to the related record's show page, on the show page and in
the data tables. A link is only rendered when the destination resource is
visible in this admin (its domain is shown, the resource is listed, and it
has a show action), so it never falls through to the wrong domain.

The behaviour can be turned off per resource with the new
`link_relationships?` admin option (defaults to `true`).

The "Show" button on `has_one`/`belongs_to` relationship panels uses the same
visibility check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant