Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Issues
  • #2329
Closed
Open
Issue created Feb 07, 2023 by YUNOO LTD@DavidGeismarLtd

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
Assignee
Assign to
Time tracking