Flash message not shown after redirected by verify

I have the following snippet in a controller.

verify :params => “post”, :only => [:create, :update, :destroy],
:add_flash => {“notice” => “Invalid Access”}, :redirect_to => {:action
=> ‘list’}

If I directly access /posts/create by typing URL (GET), the program
redirects to the “list” action, but the flash message I added is not
shown in the redirected page.

Any help would be appreciated.

T K wrote:

Any help would be appreciated.

Do you usually get flash messages from other sources? (i.e. do you have
<%= flash[:notice] %> somewhere in your layout?)

http://www.5valleys.com/

http://www.workingwithrails.com/person/8078

T K wrote:

I have the following snippet in a controller.

verify :params => “post”, :only => [:create, :update, :destroy],
:add_flash => {“notice” => “Invalid Access”}, :redirect_to => {:action
=> ‘list’}

I’m pretty sure the proper key is :flash and not :add_flash.

http://api.rubyonrails.com/classes/ActionController/Verification/ClassMethods.html#M000307

Daniel W. wrote:

T K wrote:

I have the following snippet in a controller.

verify :params => “post”, :only => [:create, :update, :destroy],
:add_flash => {“notice” => “Invalid Access”}, :redirect_to => {:action
=> ‘list’}

I’m pretty sure the proper key is :flash and not :add_flash.

Peak Obsession

Ha! Maybe I should read my own links. :slight_smile:

I’ve never seen the add_flash directive. In that case, I dunno.

How/where are you calling flash in your views?