Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (26 sloc) 1.23 KB

Common View Helpers

A set of view helpers I find myself using in most Rails applications.


cd my_rails_app
script/plugin install git://


# Use words if within the last week, otherwise use date
# Show year if not this year

# Output an easily styleable key-value pair
info_pair(label, value)  

# Give this helper an array, and get back a string of <li> elements. 
# The first item gets a class of first and the last, well.. last. 
# This makes it easier to apply CSS styles to lists, be they ordered or unordered.

# This works just like link_to, but with one difference..
# If the link is to the current page, a class of 'active' is added
link(name, options={}, html_options={})

# Absolute path to an image

# e.g. http://localhost:3000, or

# Generate a list of column name-value pairs for an AR object

Copyright © 2009 Zeke Sikelianos, released under the MIT license

Something went wrong with that request. Please try again.