# Passing the contents of a flash to a different controller

**URL:** <https://www.ruby-forum.com/t/passing-the-contents-of-a-flash-to-a-different-controller/110285>\
**Category:** Rails\
**Created:** [July 24, 2007, 10:32pm UTC](https://www.ruby-forum.com/t/passing-the-contents-of-a-flash-to-a-different-controller/110285 "2007-07-24T22:32:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![raghus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@raghus](https://www.ruby-forum.com/u/raghus)\
**Post date:** [July 24, 2007, 10:32pm UTC](https://www.ruby-forum.com/t/passing-the-contents-of-a-flash-to-a-different-controller/110285/1 "2007-07-24T22:32:15Z")

</div>

Is there a way to pass the contents of flash to a _different_  
controller/action?  
In the code below, /alpha/one will give me “The flash contains hello  
world” but /alpha/three will have just “The flash contains” - any way  
around this?

##############################################  
class AlphaController \< ApplicationController  
def one  
flash[:wibble] = ‘hello world’  
redirect\_to :action =\> ‘two’  
end  
def two  
render\_text "The flash contains " + flash[:wibble]  
end  
def three  
flash[:wibble] = ‘hello next world’  
redirect\_to :controller =\> ‘beta’, :action =\> ‘foo’  
end  
end  
##############################################  
class BetaController \< ApplicationController  
def foo  
render\_text "The flash contains " + flash[:wibble]  
end  
end  
##############################################

---

<div class="post-metadata">

**Author:** ![raghus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@raghus](https://www.ruby-forum.com/u/raghus)\
**Post date:** [July 28, 2007, 7:45am UTC](https://www.ruby-forum.com/t/passing-the-contents-of-a-flash-to-a-different-controller/110285/2 "2007-07-28T07:45:42Z")

</div>

raghus wrote:

> ```
> redirect_to :action => 'two'
> 
> ```
> 
> class BetaController \< ApplicationController  
> def foo  
> render\_text "The flash contains " + flash[:wibble]  
> end  
> end  
> ##############################################

This should work. Are you sure you actual code doesn’t  
contain an extra redirect?

–  
We develop, watch us RoR, in numbers too big to ignore.
