Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cmisenas opened this issue Dec 13, 2022 · 1 comment

Comments

@cmisenas
Copy link

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
Copy link

Have you tried passing in admin: ResourceAdmin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants