administrate
administrate copied to clipboard
Model named "Template" won't show index in admin
If I visit http://localhost:3000/admin/templates/ I get the following error:
ArgumentError in Admin::TemplatesController#index
wrong number of arguments (given 1, expected 0)
Extracted source (around line #13):
resources = resources.page(params[:_page]).per(records_per_page)
But visiting a /show page within Templates works fine. Could this be a naming convention conflict as Administrate uses templates?
do you add page or per function in app/models/template.rb?
@jubilee2 per function, but my Template model is relatively identical to my other models, it's just the only one where the index does not show.
So rename the name of function from "pre" to others to fix the issue you have.
In part, this is a problem with Kaminari, which adds the page and per methods. As I understand your comment above, your models also have the method per, so this would cause a conflict. As mentioned, renaming per to something else is easiest fix at the moment.
As for the name "template", I don't see a reason why this should work differently. Administrate uses templates, but the name "template" is not used in any special way that I can see. Are you able to share a bit more about the exception that you see, and what your pre method does?