Created
July 20, 2011 18:13
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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