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
##############################################
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Mark Reginald James
2007-Jul-28 05:40 UTC
Re: Passing the contents of a flash to a different controller
raghus wrote:> 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 > ##############################################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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---