Thanks, this is great. It works and I can see the value of the helper!
Makes the controller code so much easier. Seem "right".
I could do with a bit more help though.
1) Out of interest - how do you use the [:title => "Sort by
#{show_text}"] bit?
2) Most importantly, I got this working when I sort by columns in my
news_items table, e.g. news_item.date BUT I can't get it to work for me
as I ahve relationships built up such that I have, news_item.stock and a
stock has a name. How would I use this to sort my news_items by the
names of fields of items with them, e.g. a news_item stock name, or a
news_item news_type name.
thought i could do something like ...
<th><%= sort_link('Sector', 'news_item.sector.name') %></th>
But I can't, the SQL select generated blows up.
I might have set my relationships up wrong, but I don't think so.
BB
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---