Assign @view_module not available in template

2022-01-02T05:00:00Z threads in this section.
Attribute error:

I am working through Programming-phoenix-1.4

in the template/layout/app.html.eex file
I inserted the following code.

 <main role="main" class="container">
    <p class="alert alert-info" role="alert">
       <%= get_flash(@conn, :info) %>
    </p>
    <p class="alert alert-danger" role="alert">
       <%= get_flash(@conn, :error) %>
    </p>
    <%= render(@view_module, @view_template, assigns) %>
  </main>

I do not understand the attributes @view_module and @view_template.

In the browser it produces this error.

ArgumentError at GET /
assign @view_module not available in template.

Can anyone explain this.

That way of rendering the child template in a layout was deprecated in Phoenix v1.5 (upgrade instructions) and removed entirely in Phoenix v1.6.

What version of Phoenix are you using?

2 Likes

See this post:

2 Likes

See also:

1 Like

Phoenix v1.6