Has Many relationship, redirect to parent model
- What would you like to be able to do? Can you provide some examples?
Let's say you have :
Product has_many categories_products ``Product has_many categories through categories_products
In the product dashboard I have
ATTRIBUTE_TYPES = {
categories_products: Field::HasMany,
}
SHOW_PAGE_ATTRIBUTES = %i[
categories_products
}
which will display a table with destroy action for categories_products on the products#show page
It's currently possible to redirect to the index of the products by setting the following in the CategoriesProductsController
:
def after_resource_destroyed_path(_requested_resource)
{ action: :index, controller: :products }
end
However I don't see anywhere the possibility to redirect to the parent product from which the destroy action was initiated.
- How could we go about implementing that? I don't know
- Can you think of other approaches to the problem? I don't know