Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Created November 22, 2011 18:22
Show Gist options
  • Save typeoneerror/1386432 to your computer and use it in GitHub Desktop.
Save typeoneerror/1386432 to your computer and use it in GitHub Desktop.
module AdminHelper
def link_to_direction(field, title = nil)
title ||= field.humanize
dir = @order_dir.downcase == 'asc' ? 'desc' : 'asc'
link_to title, yield(:order => field, :dir => dir) if block_given?
end
end
= link_to_direction('name') {|params| admin_artists_path(params)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment