Is there a workaround for a model named "Page"?
Created by: milkfarm
I didn't find any documentation about reserved names for the administrate gem. Is there a workaround for a model named Page
? When I create a standard dashboard (rails g administrate:dashboard Page
), I encounter a variety of errors. For example, when trying to access the pagination links on the index
view.
NoMethodError in Admin::PagesController#index
undefined method `fetch' for "2":String
def order
@order ||= Administrate::Order.new(
params.fetch(resource_name, {}).fetch(:order, "created_at"),
params.fetch(resource_name, {}).fetch(:direction, "desc")
)
end
The issue relates to the paging/sorting information being stored under the same param key as the resource.
Rails: 6.0.3.2 administrate: 0.13.0