Rumamge.Phoenix v1.0.0 Rummage.Phoenix.Plug
This plug ensures that the rummage
params are properly set before
index
action of the controller. If they are not, then it formats them
accordingly.
This plug only works with the default Rummmage.Ecto
hooks.
Summary
Functions
conn
initializes the plug and returns the params
passed
to it
init
initializes the plug and returns the params
passed
to it
Functions
conn
initializes the plug and returns the params
passed
to it:
Examples
iex> params = %{}
iex> conn = %Plug.Conn{}
iex> Rummage.Phoenix.Plug.call(conn, params) == conn
true
iex> params = %{hooks: ["search", "sort", "paginate"]}
iex> conn = %{__struct__: Plug.Conn, params: %{}, private: %{phoenix_action: :index}}
iex> Rummage.Phoenix.Plug.call(conn, params) == %{__struct__: Plug.Conn, params: %{"rummage" => %{"paginate" => %{}, "search" => %{}, "sort" => %{}}}, private: %{phoenix_action: :index}}
true
iex> params = %{hooks: ["search", "sort", "paginate"]}
iex> conn = %{__struct__: Plug.Conn, params: %{"rummage" => %{}}, private: %{phoenix_action: :index}}
iex> Rummage.Phoenix.Plug.call(conn, params) == %{__struct__: Plug.Conn, params: %{"rummage" => %{"paginate" => %{}, "search" => %{}, "sort" => %{}}}, private: %{phoenix_action: :index}}
true