sinatra / sinatra-recipes

Community contributed recipes and techniques
http://recipes.sinatrarb.com/
463 stars 142 forks source link

Updating 'for' to 'each' making it more ruby like #106

Closed yatish27 closed 9 years ago

ghost commented 9 years ago

I agree this.

@zzak @kgrz How should I replace ruby way or add both way e.g.

This will render ./views/index.erb:

<% for post in @posts %>
  <h1><%= post.title %></h1>
<% end %>

You should also be able to do:

<%  @posts.each do |post| %>
  <h1><%= post.title %></h1>
<% end %>
zzak commented 9 years ago

I think using each() is more ruby-like, so we should use it.