View Source Plug.Assign (Plug.Assign v2.0.2)

Provides a Plug for adding assignments to the current connection.

Example

plug Plug.Assign, foo: "foo", bar: true, baz: 42

Example of use in a Phoenix Pipeline

pipeline :admin do
  plug Plug.Assign, admin: true
end

Example of use in a Phoenix Controller

defmodule Blog.Admin.PostController do
  use Blog.Web, :Controller

  plug Plug.Assign, subsection: :posts
  plug Plug.Assign, %{read_request: true} when action in [:index, :show]
  ...
end

Summary

Functions

Callback implementation for Plug.call/2.

Callback implementation for Plug.init/1.

Functions

Callback implementation for Plug.call/2.

Callback implementation for Plug.init/1.