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
  • #1885
Closed
Open
Issue created Feb 04, 2021 by Administrator@rootContributor

Models with relationships through join tables not supported

Created by: cristianriano

  • What were you trying to do?

I have a relationship many-to-many (HABTM) in my code (cocktails..ingredients). I used the ActiveRecord method create_join_table to create the join table (portions), which means it has no ID field on it's own. For the model I declared the relationship both with has_and_belongs_to_many and has_many ... through:. Then I generated the dashboards and controllers for my app and try to visit the show of one of the instances

  • What did you end up with (logs, or, even better, example apps are great!)?

I get a ActionController::UrlGenerationError in Admin::Cocktails#show error

No route matches {:action=>"show", :controller=>"admin/portions", :id=>nil}, missing required keys: [:id]

  • What versions are you running?
    • Ruby 3.0.0
    • Rails 6.1.1
    • Administrate 0.14

I know it's happening because the join table doesn't have an ID, but how is this case mean to be handled with the gem? Is there something I'm missing or I just need to add the ID?

Assignee
Assign to
Time tracking