Reputation: 1519
I'm attempting to recreate the Flash Messages guide in Phoenix however I'm getting a error that states undefined function: Phoenix.Controller.Flash.put/3 (module Phoenix.Controller.Flash is not available)
However:
I have the plug :fetch_flash
in my router.ex browser pipeline.
I have included the:
use Phoenix.Controller
alias Phoenix.Controller.Flash
at the top of the module definition. I'm also attempting to adapt the syntax to my code (where I receive a parameter in the render).
Upvotes: 2
Views: 2127
Reputation: 84180
You are looking at a really old version of the documentation (for v0.7.2
) The latest is v0.14.0
and you want the following code:
conn
|> put_flash(:error, "Some Message")
|> put_flash(:info, "Another Message")
This change was made in v0.8.0
The correct docs for your version are available at https://hexdocs.pm/phoenix/controllers.html#flash-messages
Upvotes: 4