Skip to content

Instantly share code, notes, and snippets.

@amutz
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amutz/f64e453e7825cb55a042 to your computer and use it in GitHub Desktop.
Save amutz/f64e453e7825cb55a042 to your computer and use it in GitHub Desktop.
Phoenix bug or misunderstanding?
<div>This never gets output.</div>
<% if @value > 2 do %>
<%= "This will get output." %>
<% end %>
@amutz
Copy link
Author

amutz commented May 21, 2015

The above code will not output the div on line 1. I don't know if this is a bug, or if I don't understand Phoenix templates.

@2kodes
Copy link

2kodes commented May 21, 2015

hi . i believe for tags that are supposed to output a value, you should add an equals sign. ie
<%= if @value > 2 do %> instead of <% if @value > 2 do %>
If it doesnt work you can further add an equals sign to the <% end %> too. ie <%= end %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment