Forum: Ruby on Rails Using session variables vs passing parameters via URL

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Patrick D. (Guest)
on 2008-12-22 19:02
(Received via mailing list)
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
feature of named routes that allows me to pass parameters into the named
route. So I am using things like new_document_path(: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
cannot use this feature for the #create action.  I'm not sure yet.  But
I've started thinking about this I've started to wonder if I'm going
the best path.

Would it make more sense to store @prefix, @category, @page, and
else I think I might want to pass around in the session?  Or should I
going down this route?

I should point out that the purpose of these parameters is solely to
down the number of items displayed.  They don't affect anything other
the view the user sees as (s)he navigates back and forth between the
view, the #new view, the #index view for some other controller etc...

Elliott G. (Guest)
on 2009-02-02 00:55
(Received via mailing list)
Any one have any thoughts on this one?

Thomas r. K. (Guest)
on 2009-02-02 01:57
(Received via mailing list)
Hi Patrick,

Session variables are awefull, please don't use them.
Just think of a user passing the url to another user expecting
that the other will see the same content but with weird session
variables that wouldn't happen.

ciao, tom

On Dec 22 2008, 6:01 pm, "Patrick D." <removed_email_address@domain.invalid> 

> 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?

Thomas R. "TomK32" Koll <>
just a geek trying to change the world
This topic is locked and can not be replied to.