Module: ApplicationHelper

Defined in:
app/helpers/application_helper.rb

Overview

main helper module

Instance Method Summary collapse

Instance Method Details

#sortable(column, title = nil) ⇒ Object

Generates the sorting hyperlink for the specified column



8
9
10
11
12
13
# File 'app/helpers/application_helper.rb', line 8

def sortable(column, title = nil)
	# Capitalize first letter of each word only if title is nil 
 		title ||= column.titleize
 		direction = (column == sort_column && sort_direction == "asc") ? "desc" : "asc"
 		link_to title, {:sort => column, :direction => direction}
end