Skip to content

Instantly share code, notes, and snippets.

@dLobatog
Created February 18, 2012 01:22
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 dLobatog/1856734 to your computer and use it in GitHub Desktop.
Save dLobatog/1856734 to your computer and use it in GitHub Desktop.
Bad code
<% people = Person.find(
:conditions => ["added_at > ? and deleted = ?", Time.now.utc, false],
:order => "last_name, first_name") %>
<% people.reject { |p| p.address.nil? }.each do |person| %>
<div id="person-<%= person.new_record? ? "new" : person.id %>">
<span class="name">
<%= person.last_name %>, <%= person.first_name %>
</span>
<span class="age">
<%= (Date.today - person.birthdate) / 365 %>
</span>
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment