Skip to content

Instantly share code, notes, and snippets.

@kke
Last active December 17, 2015 01:29
Show Gist options
  • Select an option

  • Save kke/5528794 to your computer and use it in GitHub Desktop.

Select an option

Save kke/5528794 to your computer and use it in GitHub Desktop.
<% apples = Apple.find(:all) %> # now apples = [apple1, apple2, apple3]
<ul>
<% apples.each do |item| %> # take apples one by one, always calling the current apple "item"
<li>id: <%= item.id %></li> # item.id = id of the apple currently being processed
<li>name: <%= item.name %></li> # item.name = name of the apple currently being processed
<li>price: <%= item.price %></li># item.price = price of apple currently being processed
<% end %>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment