# Sortable\_column\_header

**URL:** <https://www.ruby-forum.com/t/sortable-column-header/148812>\
**Category:** Rails\
**Created:** [September 17, 2008, 9:52am UTC](https://www.ruby-forum.com/t/sortable-column-header/148812 "2008-09-17T09:52:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chovy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecd19e/32.png) [@chovy](https://www.ruby-forum.com/u/chovy)\
**Post date:** [September 17, 2008, 9:52am UTC](https://www.ruby-forum.com/t/sortable-column-header/148812/1 "2008-09-17T09:52:42Z")

</div>

Is there any way to make the plugin attach a class to its link?  
(mainly sort direction).

This is rather ugly, looking for the purist way…

\<%= link\_to 'Name', sort\_param('search', Directory, 'name'), { :class =\> sort\_param('', Directory, 'name' ).to\_s.sub(/^(.+)-.+/, '\1') } %\>

yields:

...

–  
Anthony E.  
408-656-2473  
[http://anthony.ettinger.name](http://anthony.ettinger.name)
