Skip to content

Rails Admin doesn't handle STI to single table #3373

@Naokimi

Description

@Naokimi

I have 2 different classes inheriting from User but saving in the same table:

class User < ApplicationRecord
  # devise stuff
end

class Participant < User
  has_many :participant_stamps
  has_many :stamps, through: :participant_stamps
end

class Vendor < User
  has_many :vendor_stamps
  has_many :stamps, through: :vendor_stamps
end

I'd like to add a VendorStamp using rails admin, but when I go to the tab, the relation is missing, which of course throws an error when trying to save
image

I also tried to explicitly tell it to look for a vendor (see below), but with no luck

RailsAdmin.config do |config|
  config.model 'VendorStamp' do
    list do
      field :stamp
      field :vendor
    end
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions