I can''t help with the sort helper, but I did just release a Rails
plugin gem to help with setting up sortable tables in Rails:
http://sortablecolumns.rubyforge.org/
On Mar 19, 3:25 pm, loominator1970
<loominator1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> hello,
>
> I''m attempting to implement the code created by Dave Burt to sort
by
> column headers shown here:
>
> http://www.koders.com/ruby/fidA98C27CE5EEE13550817B81CF0B07DAADAAA9B3...
>
> Well, i wouldn''t be writing here if it worked, so I''m
wondering if
> someone could tell me what i''m doing wrong. I keep getting the
error,
> "uninitialized class variable @@sort_keys in SortHelper". Below
is my
> view code that is getting hung up and my controller code. Any advice
> would help
>
> Dave
>
> ## View:
> <div id="tool-list">
> <table cellspacing ="0">
> <tr>
> <th align="left"><%= link_to_sort_by
''Title'', ''title'' %></th>
> <th align="left">Description</th>
> <th align="left"><%= link_to_sort_by
''Status'', ''status'' %></th>
> <th align="left"><%= link_to_sort_by
''Priority'', ''priority'' %></
> th>
> <th align="left"><%= link_to_sort_by
''Owner'', ''owner'' %></th>
> <th align="left"><%= link_to_sort_by
''Eta'', ''eta'' %></th>
> </tr>
>
> ## Controller:
>
> class ToolsController < ApplicationController
>
> helper :sort
> include SortHelper
>
> # the following method should sort columns
>
> def list # action
> SortHelper.columns = %w[
> title
> status
> priority
> owner
> eta
> ]
> SortHelper.default_order = %w[title status priority owner eta]
> @people = Person.find_all.sort do |a, b|
> SortHelper.sort(a, b, @params)
> end
> end
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---