How to display a tableless model on rails admin dashboard

516 Views Asked by At

I am trying to display a particular model on dashboard (which does not have backend table ) but unable to do so.

The rails admin code does not picks it up and does not gets displayed on dashboard.

I have already defined the model configuration inside RailsAdmin initializer file.

Please suggest what could be missing here.

Thanks in advance.

2

There are 2 best solutions below

1
On

If you're trying to use a model without a table you can do this:

class YourModelName
  include ActiveModel::Model

  ...
  # Your code goes here, make sure you leave the persisted? method


  def persisted?
    false
  end
end
0
On

Reading https://github.com/railsadminteam/rails_admin/issues/1377 it seems currently ActiveModel is not supported yet. There had been some attempts back in 2012 but did not come into fruition.