CastParams
Casting params in controllers
defmodule ExampleController do
cast_params(category_id: :integer) when action == :index
cast_params(name: :string!, terms: :boolean!) when action == :create
def index(conn, params) do
end
def create(conn, params) do
end
end
Installation
If available in Hex, the package can be installed
by adding cast_params
to your list of dependencies in mix.exs
:
def deps do
[
{:cast_params, "~> 0.0.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/cast_params.