I have a model called `Action`. How do I avoid the conflict with the `action` parameter?
Created by: mattgibson
My model called Action
has a dashboard, but this error happens preventing it from loading:
undefined method `fetch' for "index":String
Which comes from this part of administrate/application_controller.rb
around line 103:
def order
@order ||= Administrate::Order.new(
params.fetch(resource_name, {}).fetch(:order, nil), # <-- error here
params.fetch(resource_name, {}).fetch(:direction, nil),
)
end
The problem is that resource_name
is action
, which conflicts with the normal param called action
which tells us that in this case, we want the index
. We therefore get 'index'
from the params, not nil
which would give us the default empty object, which fetch would work on.
Is there a way around this?