Q:

Application Controller method called from ajax

I have a method in my application controller.
def session_selected(id)
  session[:selected] = [] if session[:selected].blank?
  if session[:selected].include?(id)
    session[:selected].delete(id)
  else
    session[:selected] << id
  end
end

I have a call to it from my .js file
function check_set(id){
  $.ajax({url: 'session_selected',
  data: {id: id},
  method: 'get'});
  window.location.reload();
}

The method never seems to see the id come in from the params...
Started GET "/session_selected?id=5" for 127.0.0.1 at 2014-08-27 10:36:45 -0700
Processing by ApplicationController#session_selected as */*
  Parameters: {"id"=>"5"}
Completed 500 Internal Server Error in 1ms

ArgumentError - wrong number of arguments (0 for 1):

Also, are there any good resources for this?

A:

Thanks guys for the help
Application Controller
def session_selected()
  id = params[:id]
  session[:selected] = [] if session[:selected].blank?
  if session[:selected].include?(id)
    session[:selected].delete(id)
  else
    session[:selected] << id
  end
end

