I'm just starting to learn gem 'rails_admin' and don't understand much yet.
I have two models connected by a polymorphic relationship
class Event < ApplicationRecord
has_many :object_documents
end
and
class ObjectDocument < ApplicationRecord
belongs_to :event
belongs_to :object, polymorphic: true
has_many_attached :document
end
in event model i want to add name field for loaded document and the document itself (naturally, all this data will be taken from the ObjectDocument model)
I've been scratching my head for a long time and don't know how to implement it.
Maybe I'm going in the wrong direction. Sorry for my English, it's not my native language
i tried to do it this way
module RailsAdminModels
module Event
extend ActiveSupport::Concern
included do
rails_admin do
edit do
field :object_documents do
partial "object_document"
end
...
but it doesn't work for me. Or I don't style the view correctly