I am struggling to understand pattern matching in my specific case; I'm trying to get the values from params
, which I think is a struct, in a Phoenix controller.
Typing params
in iex
results in
%{"edit" => "93213e66-a15e-11e6-8bc7-38c986312498",
"job_slug" => "7759-tkhkjd-test"}
However, running the following command:
pry(7)> {edit, job_slug} = params
throws this error:
** (MatchError) no match of right hand side value: %{"edit" => "93213e66-a15e-11e6-8bc7-38c986312498", "job_slug" => "7759-tkhkjd-test"}
(stdlib) :erl_eval.expr/3
How do I correctly pattern match against params
?