trestle icon indicating copy to clipboard operation
trestle copied to clipboard

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

Open cmisenas opened this issue 2 years ago • 1 comments

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?

cmisenas avatar Dec 13 '22 16:12 cmisenas

Have you tried passing in admin: ResourceAdmin?

Partytray avatar Dec 28 '22 17:12 Partytray