rummage_phoenix icon indicating copy to clipboard operation
rummage_phoenix copied to clipboard

** (KeyError) key :paginate not found in: %{"paginate" => %{}, "search" => %{}, "sort" => %{}}

Open oladipo opened this issue 3 years ago • 0 comments

trying to use rummage to paginate ecto collection. Got the following error:

** (KeyError) key :paginate not found in: %{"paginate" => %{}, "search" => %{}, "sort" => %{}} (rummage_phoenix 2.0.0) lib/rummage_phoenix/hooks/views/paginate_view.ex:93: Rummage.Phoenix.PaginateView.first_page_link/3 (rummage_phoenix 2.0.0) lib/rummage_phoenix/hooks/views/paginate_view.ex:44: Rummage.Phoenix.PaginateView.pagination_link/3 (pps 0.1.0) lib/pps_web/templates/transaction/index.html.eex:61: PpsWeb.TransactionView."index.html"/1 (phoenix 1.5.8) lib/phoenix/view.ex:310: Phoenix.View.render_within/3 (phoenix 1.5.8) lib/phoenix/view.ex:472: Phoenix.View.render_to_iodata/3 (phoenix 1.5.8) lib/phoenix/controller.ex:776: Phoenix.Controller.render_and_send/4 (pps 0.1.0) lib/pps_web/controllers/transaction_controller.ex:1: PpsWeb.TransactionController.action/2 (pps 0.1.0) lib/pps_web/controllers/transaction_controller.ex:1: PpsWeb.TransactionController.phoenix_controller_pipeline/2 (phoenix 1.5.8) lib/phoenix/router.ex:352: Phoenix.Router.__call__/2 (pps 0.1.0) lib/pps_web/endpoint.ex:1: PpsWeb.Endpoint.plug_builder_call/2 (pps 0.1.0) lib/plug/debugger.ex:136: PpsWeb.Endpoint."call (overridable 3)"/2 (pps 0.1.0) lib/pps_web/endpoint.ex:1: PpsWeb.Endpoint.call/2 (phoenix 1.5.8) lib/phoenix/endpoint/cowboy2_handler.ex:65: Phoenix.Endpoint.Cowboy2Handler.init/4 (cowboy 2.8.0) /opt/app/pps/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2 (cowboy 2.8.0) /opt/app/pps/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3 (cowboy 2.8.0) /opt/app/pps/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3 (stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

using Phoenix 1.5.8

see controller action:

` def index(conn, params) do

Logger.debug("params: #{ inspect(params) }")

# transactions = Transactions.list_transactions()
{ transactions, rummage } = Transactions.paginate_transactions(params)

Logger.debug("params: #{ inspect(params) }, transactions: #{ inspect(transactions) }")

# rummage = for {key, val} <- rummage, into: %{}, do: {String.to_atom(key), val} |> Map.put(:page, 1)

Logger.debug("rummage: #{ inspect(rummage) } ")

render(conn, "index.html", transactions: transactions, rummage: rummage )

end`

<%= pagination_link(@conn, @rummage) %>

looks like the library expects keys to be atoms, but my controller is supplying string keys.

oladipo avatar May 03 '21 13:05 oladipo