You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the administrate UI you end up with on program#show :
and on program#edit :
On both page the item field from Product is visible or editable, but in that case it doesn't make sense to show or edit the item column because I am already on the page of the resource I want to edit.
How could we go about implementing that?
Is there an option I can pass to Field::HasOne to tell it to display only certain fields ? Something like :
product: Field::HasOne.with_options(except: %i[ item_type item_id])
Can you think of other approaches to the problem?
The text was updated successfully, but these errors were encountered:
For this to work, the HasMany field would have to link to a different version of the Product dashboard. One under /admin/programs/:id/products, as opposed /admin/products. This way, it would be able to use the URL to identify that a different dashboard (or dashboard configuration) should be used.
This falls under the category of changes to namespacing and dashboard definition that should be handled at some point. For now, I can only thank all of you coming to us with use cases, as these will help us create a better solution in the future.
I'd like to be able to include a HasOne field on on a Show page but not have the entire object (and all of its own nested HasOne entire objects) displayed.
In some cases I'd rather just have a simple link to the referenced object. Is there anyway to do that right now? I was picturing something like Field::HasOne.with_options(expand: false)
@richardonrails - I recommend creating a new field type; say Field::HasOneLink that behaves as you expect. You can copy (or perhaps inherit) the existing Field::HasOne and build on top of it.
Let's say I have a
Program has_one Product as: :item
where Product handles polymorphic association withitem_type
anditem_id
column.In my Program dashboard, I want to make product editable :
In the administrate UI you end up with on program#show :
and on program#edit :
On both page the item field from
Product
is visible or editable, but in that case it doesn't make sense to show or edit the item column because I am already on the page of the resource I want to edit.Is there an option I can pass to Field::HasOne to tell it to display only certain fields ? Something like :
product: Field::HasOne.with_options(except: %i[ item_type item_id])
The text was updated successfully, but these errors were encountered: