Replies: 2 comments
-
... a bit more digging into the loco source seems to indicate the scaffold view generator just ignores reference fields altogether (for now). Lines 33 to 45 in 96297d6 I'd be interested in making this work, at least when the field is a reference to one of a few well known lists of FKs that I could cache in the context ahead of time. |
Beta Was this translation helpful? Give feedback.
-
Hey @bobhy, At the moment, we don't support references in views. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Using SaaS starter, generating for htmx rendering.
Issuing these commands:
I was hoping this would generate an htmx view for
accounts
that renders the reference field (beneficiary_id
) as a dropdown or other select where the options are available values of the foreign key in the referenced table. But I find the generated view doesn't include any beneficiary field:assets/views/accounts/show.html
The DB schema looks reasonable:
Should I have expected Loco to generate a view with the reference field for me (at 0.14.1)?
If so, can anyone spot what I did wrong? Or offer some suggestions where in the code I can learn how to make this work? I've been all through the existing docs and couldn't find any hints.
If I can get this working, I'll be glad to update the docs for to cover this (common-ish?) scenario. I'd even look into a code change to do this...
I get it that rendering the
beneficiary_id
field would just show a list of integers, not very interesting. What I really want to show in the dropdown would be a list of beneficiary names, which is the kind of change I'd expect to make myself in the scaffolded view template.Beta Was this translation helpful? Give feedback.
All reactions