I would like to highlight a table header depending on a variable's name passed in via the params.
In the controller I have:
case sort
when 'grade'
@sort_by_grade = 'highlight'
when 'student_name'
@sort_by_student_name = 'highlight'
end
Is there a more elegant way to do this? For instance, something like:
"sort_by_#{sort}" = 'highlight'
My table headers code are something like this in Haml:
%th{:class => @sort_by_grade}