# How to transfer variables from one page to another page?

**URL:** <https://www.ruby-forum.com/t/how-to-transfer-variables-from-one-page-to-another-page/59991>\
**Category:** Rails\
**Created:** [May 9, 2006, 9:04am UTC](https://www.ruby-forum.com/t/how-to-transfer-variables-from-one-page-to-another-page/59991 "2006-05-09T09:04:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tiwaripk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7ab992/32.png) [@tiwaripk](https://www.ruby-forum.com/u/tiwaripk)\
**Post date:** [May 9, 2006, 9:04am UTC](https://www.ruby-forum.com/t/how-to-transfer-variables-from-one-page-to-another-page/59991/1 "2006-05-09T09:04:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tiwaripk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7ab992/32.png) [@tiwaripk](https://www.ruby-forum.com/u/tiwaripk)\
**Post date:** [May 9, 2006, 2:13pm UTC](https://www.ruby-forum.com/t/how-to-transfer-variables-from-one-page-to-another-page/59991/2 "2006-05-09T14:13:31Z")

</div>

On May 9, 2006, at 03:04 AM, Prashant T. 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

---

<div class="post-metadata">

**Author:** ![tiwaripk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7ab992/32.png) [@tiwaripk](https://www.ruby-forum.com/u/tiwaripk)\
**Post date:** [May 9, 2006, 2:29pm UTC](https://www.ruby-forum.com/t/how-to-transfer-variables-from-one-page-to-another-page/59991/3 "2006-05-09T14:29:50Z")

</div>

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.
```

---

<div class="post-metadata">

**Author:** ![tiwaripk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7ab992/32.png) [@tiwaripk](https://www.ruby-forum.com/u/tiwaripk)\
**Post date:** [May 9, 2006, 6:39pm UTC](https://www.ruby-forum.com/t/how-to-transfer-variables-from-one-page-to-another-page/59991/4 "2006-05-09T18:39:07Z")

</div>

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  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)
