I have been tweaking my index view in order to narrow down the amount of data displayed. The obvious first step was to add will-paginate, but then I added a couple of select boxes to narrow things down a bit more based on categories. Somewhere in the midst of all of this I discovered the way cool feature of named routes that allows me to pass parameters into the named route. So I am using things like new_document_path(:category => @category, :prefix => @prefix) in order to pass the values of @category and @prefix from my “index” view into my “new” view.
I am trying to do the same thing with the named route in a form (i.e. form_for (document_path(:prefix => @prefix, ;category => @category, :page => @page) …) and am running into some problems. It may be the case that I cannot use this feature for the #create action. I’m not sure yet. But as I’ve started thinking about this I’ve started to wonder if I’m going down the best path.
Would it make more sense to store @prefix, @category, @page, and whatever else I think I might want to pass around in the session? Or should I keep going down this route?
I should point out that the purpose of these parameters is solely to narrow down the number of items displayed. They don’t affect anything other than the view the user sees as (s)he navigates back and forth between the #index view, the #new view, the #index view for some other controller etc…