Okay I figured 80% of this out on my own after some trial and testing. I still need help with params.merge on the forms only. Here's what I did for the rest:
def sort_column(title, direction) direction == "asc" ? image = "up.gif" : image = "down.gif" (link_to image_tag(image, :border=>0, :alt => direction), params.merge(:controller => controller.controller_name, :numteams => (@showall ? 120 : nil), :orderby => title, :sortby => direction)) end # adds a button to show all teams on tables based on controller name called. def show_all_teams (link_to "Show All Teams", params.merge(:controller => controller.controller_name, :numteams => 120, :orderby => 'rank', :sortby => 'asc', :page => 1, :search => nil)) if !@showall end # adds a button to show simplified views on tables based on controller ame called.. def show_simple_view (link_to "Show Simple View", params.merge(:controller => controller.controller_name, :numteams => nil, :orderby => 'rank', :sortby => 'asc')) if @showall || @searchteams end
I added params.merge to the link tos and it just merged the params with the existing ones with no changes. I had to modify the Show All Teams link to show :page => 1 since it would get stuck if it was on simple view and a page requester was say on 3.. I also had to change the :search => nil so that show all would clear any search results and show all teams.
This entire fix worked for 80% of the content.
Now, I still have issues with my forms. Here are the views:
<td align="left" valign="middle"> <% form_tag controller.controller_path, :method => 'get' do %> <%= hinted_text_field_tag :search, params[:search], "Enter Team" %> <%= submit_tag "Team Search", :name => nil %> <% end %> </td> <td align="left" valign="middle"> <% form_tag controller.controller_path, :method => 'get' do %> <%= calendariffic_input(true, :compiled_on, 'calendariffic/date.png', 'search_cal', '%Y-%m-%d', params[:compiled_on], {}, {:class => 'borderless'}) %> <%= submit_tag "Date Search", :name => nil %> <% end %> </td>
How do I use params merge with the forms?
Many thanks in advance.