# Flash message not shown after redirected by verify

**URL:** <https://www.ruby-forum.com/t/flash-message-not-shown-after-redirected-by-verify/138144>\
**Category:** Rails\
**Created:** [May 20, 2008, 4:21pm UTC](https://www.ruby-forum.com/t/flash-message-not-shown-after-redirected-by-verify/138144 "2008-05-20T16:21:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![T\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e0b2c6/32.png) [@T\_K](https://www.ruby-forum.com/u/T_K)\
**Post date:** [May 20, 2008, 4:21pm UTC](https://www.ruby-forum.com/t/flash-message-not-shown-after-redirected-by-verify/138144/1 "2008-05-20T16:21:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![T\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e0b2c6/32.png) [@T\_K](https://www.ruby-forum.com/u/T_K)\
**Post date:** [May 20, 2008, 5:33pm UTC](https://www.ruby-forum.com/t/flash-message-not-shown-after-redirected-by-verify/138144/2 "2008-05-20T17:33:36Z")

</div>

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.5valleys.com/)

[http://www.workingwithrails.com/person/8078](http://www.workingwithrails.com/person/8078)

---

<div class="post-metadata">

**Author:** ![T\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e0b2c6/32.png) [@T\_K](https://www.ruby-forum.com/u/T_K)\
**Post date:** [May 20, 2008, 9:26pm UTC](https://www.ruby-forum.com/t/flash-message-not-shown-after-redirected-by-verify/138144/3 "2008-05-20T21:26:41Z")

</div>

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](http://api.rubyonrails.com/classes/ActionController/Verification/ClassMethods.html#M000307)

---

<div class="post-metadata">

**Author:** ![T\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e0b2c6/32.png) [@T\_K](https://www.ruby-forum.com/u/T_K)\
**Post date:** [May 20, 2008, 9:28pm UTC](https://www.ruby-forum.com/t/flash-message-not-shown-after-redirected-by-verify/138144/4 "2008-05-20T21:28:14Z")

</div>

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](http://api.rubyonrails.com/classes/ActionController/Verification/ClassMethods.html#M000307)

Ha! Maybe I should read my own links. 🙂

I’ve never seen the add\_flash directive. In that case, I dunno.

How/where are you calling flash in your views?
