Skip to content

Instantly share code, notes, and snippets.

@jdibiccari
Created June 10, 2014 03:27
Show Gist options
  • Save jdibiccari/6a430c631c7baccd8633 to your computer and use it in GitHub Desktop.
Save jdibiccari/6a430c631c7baccd8633 to your computer and use it in GitHub Desktop.
blog_post_5
<!-- Example of an each loop -->
<ul>
<%Artist.list_alphabetically.each do |artist|%>
<li><a href="artists/<%=artist.url%>"><%=artist.name%></a> song count: <%=artist.songs_count%></li>
<%end%>
</ul>
<!-- Example of an if statement -->
<h4><%=artist.name%> - <%=artist.songs_count%>
<%if artist.songs_count > 1%>
Songs
<%else%>
Song
<%end%>
</h4>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment