I have a view with a table that contains sortable links as headings.
Here is the code used to create these sortable links in the
application_helper:
module ApplicationHelper
def sort_link_helper(text, param)
key = param
key += "_reverse" if @params[:sort] == param
link_to(text, :controller => ''sales_orders'', :action
=> ''list'',
:sort => key )
end
end
Here is the code in my controller where I call the sort_link_helper
function:
<tr>
<th><%= sort_link_helper ''Number'',
''id'' %></th>
<th><%= sort_link_helper ''Sold To'',
''sold_to'' %></th>
<th><%= sort_link_helper ''Ship To'',
''ship_to'' %></th>
<th><%= sort_link_helper ''Rep'',
''rep'' %></th>
<th><%= sort_link_helper ''Description'',
''description'' %></th>
<th><%= sort_link_helper ''Amount'',
''amount'' %></th>
<th><%= sort_link_helper ''Ship Date'',
''ship_date'' %></th>
<th>Current Status</th>
</tr>
The problem is that sometimes, when I click one of these links to sort
the table by that field, I get the following error:
Showing app/views/sales_orders/list.rhtml where line #29 raised:
Invalid argument
Extracted source (around line #29):
26: <th><%= sort_link_helper ''Rep'',
''rep'' %></th>
27: <th><%= sort_link_helper
''Description'', ''description''
%></th>
28: <th><%= sort_link_helper ''Amount'',
''amount'' %></th>
29: <th><%= sort_link_helper ''Ship Date'',
''ship_date'' %></th>
30: <th>Current Status</th>
31: </tr>
32:
It is maddeningly inconsistent. Sometimes, I can just do a refresh and
it''ll work fine. Sometimes I have to refresh several times before I
can
get it to work. Also, the line number causing the error will be
different sometimes, but it''s always one of the lines with the
sort_link_helper in it.
Any ideas on how I can get this fixed?
Thanks!
--
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
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
-~----------~----~----~----~------~----~------~--~---