Topic: Query Regarding Routes

Hi all,

I have a form in which there are two combos named 'Group' and 'Gender' based on this two combos the data in the table should be updated. The problem is how can i access the parameters ':id' and ':gender' on the click event of any one combo. To make it more clear i'll post my code below.

new.html.erb
-----------------
<%= f.select :group_id, options_for_select([["All", "all"]] + Group.order.map{ |group| [group.name, group.id] }), {} %>
<%= f.select :gender, options_for_select([["All" , "all"]] + [["Male" , "male"]] +  [["Female" , "female"]]), {} %>

showEmp.js.erb
---------------------
$('div.Employee').html("<%= escape_javascript( render 'showEmp' ) %>");

showGender.js,erb
------------------------
$('div.Employee').html("<%= escape_javascript( render 'showEmp' ) %>");

showEmp
------------
(Displays the data in a table view)

employees_controller.rb
-------------------------------
def showEmp
@employees = Employee.find_all_by_group_id(params[:id])

    respond_to do |format|
      format.js { render }
    end
end

def showGender
  @employees = Employee.find_all_by_gender(params[:gender])

   respond_to do |format|
        format.js { render }
    end
end

routes.rb
------------
match 'employeesGender/:id', :to => 'employees#showEmp'
match 'employeesGender/:gender', :to => 'employees#showGender'
resources :employees

Currently i am being able to filter the data on the basis of individual combo's change event but not on two combos change event.What i need is that even on the change event of group combo i want the selected item of the gender combobox.

Pls direct me towards a solution.

Regards,
AB