TrestleAdmin / trestle

A modern, responsive admin framework for Ruby on Rails
https://trestle.io
GNU Lesser General Public License v3.0
1.96k stars 177 forks source link

How to fix "to_param called on non-resourceful admin. You may need to explicitly specify the admin." #430

Open cmisenas opened 1 year ago

cmisenas commented 1 year ago

I have an admin view set up similar to the following:

# admin.rb
Trestle.admin(:some_admin_view_showing_various_resource_tables) do
...
  controller do
    def show
       @resource = Resource.find(params[:resource_id])
    end
  end
...
end

I also have a resource view set up like so

# resource.rb
Trestle.resource(:resource) do
  table do
    column :id
    ....
  end
end

In the template I have

# admin/show.rb
...
<%= table ResourceAdmin.table, collection: resource.things %>

But I am getting the error to_param called on non-resourceful admin. You may need to explicitly specify the admin.. I have also tried to pass in the table as admin: ResourceAdmin.table but the error still shows. How do I fix this?

Partytray commented 1 year ago

Have you tried passing in admin: ResourceAdmin?