Skip to content

Instantly share code, notes, and snippets.

@zporter
Created July 20, 2011 18:13
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 zporter/1095529 to your computer and use it in GitHub Desktop.
Save zporter/1095529 to your computer and use it in GitHub Desktop.
HTML Helper method to return appropriate class name based on iteration in the each loop
def collection_class_name(collection, index)
if index == 0
return 'first'
elsif index == ( collection.size - 1 )
return 'last'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment