1
votes

This causes an exception, it's an obfuscated version:

    <% if @aaa == 1 %>
      <b>Hi</b>
    <% else %>
      <b>Hi2</b>
      <b<%= @var %>
    <% end %>


    <b><%= @var3 %><%= @var4%>

    <% if @var5 == @var6 %>
      <b>Hi3</b>
    <% else %>
      <b>Hi4</b>
    <% end %>

The error is:

== Compilation error on file web/views/my_model_view.ex ==
** (FunctionClauseError) no function clause matching in EEx.Compiler.generate_buffer/4

What's wrong with this?

1
You are missing a do in your ifs.Gazler

1 Answers

3
votes

In Elixir syntax for if's is if do end.

Ruby/Rails:

<% if ... %>
<% end %>

Elixir/Phoenix:

<% if ... do %>
<% end %>