Ruby on Rails rails_admin add custom model section without needing to create a table

42 views Asked by At

I need to add into my rail admin panel in the model list to interact with the database a custom section without a table related to it. Like a "fake" model we can say. Already tried to create a Fake model but can't make it work.

gem 'rails_admin', '~> 2.1.0'

rails_admin.rb

require Rails.root.join('app/models', 'remediation.rb')

config.included_models = ['Remediation']

config.model Remediation do
    visible true

end

app/models/remediation.rb

Already tried with all the commented configurations and possible combinations with the model.

class Remediation < ApplicationRecord 

  # or ActiveRecord::Base or include ActiveModel::Model
  # attr_accessor :some_attribute
  # self.table_name = :assessment_high_risk_factor

  rails_admin do
    
  end
end

The idea is to add here (under the 'Answers' model for example) a fake model without a table back named 'Remediation' and customize the view columns to list and edit with current existent models: My admin panel navigation models list

0

There are 0 answers