Forum: Ruby on Rails How to transfer variables from one page to another page ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8c70506408fddb9740b4de7339055c77?d=identicon&s=25 Prashant Tiwari (tiwaripk)
on 2006-05-09 09:04
Hi,

In my application I want to tranfer a variable (store_id) from one page
to next without putting it into session. How should I do this?
Is there any way to transfer variable from one to other page using
methods other than sesion?

Thanx

Prash
7c4087d053eb02d099a17d91ba5e33b5?d=identicon&s=25 Brian Hughes (Guest)
on 2006-05-09 14:13
(Received via mailing list)
On May 9, 2006, at 03:04 AM, Prashant Tiwari wrote:
> In my application I want to tranfer a variable (store_id) from one
> page
> to next without putting it into session. How should I do this?
> Is there any way to transfer variable from one to other page using
> methods other than sesion?

You do realize that this is _precisely_ why the concept of Session
Management exists, in web applications, don't you? Why would you not
want to make use of that?

As for other ways, the easiest (assuming you only have one or two
simple values) is to pass the variables as parameters to the URL
being called. That way, they will be part of the params[] object in
the next action.

-Brian
13ea48f056b19349027d2f4a6921a46a?d=identicon&s=25 Jean-François (Guest)
on 2006-05-09 14:29
(Received via mailing list)
Hello Prashant,

> In my application I want to tranfer a variable (store_id) from one page
> to next without putting it into session. How should I do this?
> Is there any way to transfer variable from one to other page using
> methods other than sesion?

You can use flash.

flash[:store_id] = store_id

then you retrieve in the second action : @id = flash[:store_id]

    -- Jean-François.
6076c22b65b36f5d75c30bdcfb2fda85?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-05-09 18:39
(Received via mailing list)
On May 9, 2006, at 5:29 AM, Jean-François wrote:

> flash[:store_id] = store_id
>
> then you retrieve in the second action : @id = flash[:store_id]
>
>    -- Jean-François.
>
> -


Except flash is just stored in the session ;) Serioulsy, you need to
give us more info as to why you don't want to use the session?
Sessions whole reason to exist is to hold state between stateless
http transactions.

-Ezra_______________________________________________
Rails mailing list
Rails@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails
This topic is locked and can not be replied to.