Thank you Ohm,
The termid=2 is the selection from the drop down select menu, which is used to filter the enrollments to the selected term. I am passing that value via ajax to the server to set the session value session[:termid]. Then each page checks that in a before filter.
I created a sessions controller like this:class SessionsController < ApplicationController def self.set_user_term(termid) user_session.set_term(termid) end endI put this line at the top of the routes.rb file:get 'set_user_term', to: 'sessions#set_user_term'
When I put this in the browser:http://localhost:3000/set_user_term?termid=2
I get :Unknown action The action 'set_user_term' could not be found for SessionsController
Almost had it. Your set_user_term shouldn't be a class method. And like Jemagee says, you'll have to have a view, or render nothing like so:
class SessionsController < ApplicationController def set_user_term(termid) user_session.set_term termid render :nothing => true end end
If you want a JSON ok back, you could render that with
render :json => :ok