I am grateful to this forum for helping me out yesterday and I'm wondering if you might get me over another hump today. I come from a .NET background and I can't seem to get the Rails way to do something that seems like it should be simple. I have read through so many posts about topics which almost address this, but nothing quite gets me all the way there. I would really appreciate your expertise.
This is a student enrollment app with students, classes, enrollments, etc.
I am storing a term_id value in the session. It needs to be available to all pages, since most things are viewed by the term. I need each page to have a header with a dropdown menu, so that the user can change the term at any time (these are week-long terms : week 1, week 2, etc). This will display enrollments or classes, etc. filtered for the currently selected term.
In .NET I might have a code-behind event (like term_selectChanged) in which I would set the session value to the selected value. I am guessing that there is a Rails way which is just as simple, but I can't seem to find it. Even the book "Rails for .NET Developers" doesn't seem to talk about this. I have successfully implemented collection_select for existing forms, and have tried modifying various versions of select and form helpers, but my head is spinning and I am getting nowhere. I am loving Rails so I think there must be an easy way that is right under my nose.
I have also created a user_session model class (without a backing table) as suggested by Ryan Bates (http://railscasts.co...ion-based-model), which allows me to wrap the session in a helper method. I think I understand how that works, but I am not sure it helps me in any way with this.
I would really appreciate some guidance. I am open to not using session if there is a better way to have a variable available to all pages.