2

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)

Phoenix module 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).

4

1 回答 1

4

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

于 2015-07-22T13:43:14.913 回答