On 2006-07-21, at 23:48 , Rick Olson wrote:
Now regarding this flash business, is it possible to do flash.keep if
you want to keep the flash on a halted before filter (assuming the
default is changed to just sweep unconditionally)?
If, in the halting before filter, you need to keep the flash from the
previous action, calling flash.keep will work fine.
Here's another contrived example that demonstrates that:
class TestController < ApplicationController
FLASH = "<pre><%=
{}.update(flash).to_yaml %><%=
{}.update(flash.instance_variable_get('@used')).to_yaml %></pre>"
before_filter :redir, :only => 'skip'
def one
flash[:foo] = 'bar'
render :inline => "#{FLASH}1. <%= link_to 'next', :action =>
'skip' %>"
end
def skip
render :inline => "#{FLASH}skip"
end
def two
render :inline => "#{FLASH}2. <%= link_to 'next', :action =>
'three' %>"
end
def three
render :inline => "#{FLASH}3. see..."
end
private
def redir
flash.keep
redirect_to :action => 'two'
false
end
end
With my patch, the flash will be available to actions: one, skip,
two. Without it, action three will still have the flash, which feels
buggy.
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core