RailsCasts Pro episodes are now free!

Learn more or hide this

Aaron James Banda's Profile

GitHub User: ajibanda

Site: http://www.ajibanda.com

Comments by Aaron James Banda

Avatar

great! I just made a minor adjustment so that it adapts the twitter bootstrap framework's icons

ruby
def sortable(column, title = nil)
        title ||= column.titleize
        css_class = column == sort_column ? "current #{sort_direction}" : nil
        direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
        link_to "#{title} <i class='#{direction == "desc" ? "icon-chevron-down" : "icon-chevron-up"}'></i>".html_safe, {:sort => column, :direction => direction}, {:class => css_class}
end