# How to get flash errors to display in edge?

**URL:** <https://www.ruby-forum.com/t/how-to-get-flash-errors-to-display-in-edge/104557>\
**Category:** Rails\
**Created:** [May 19, 2007, 2:52pm UTC](https://www.ruby-forum.com/t/how-to-get-flash-errors-to-display-in-edge/104557 "2007-05-19T14:52:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://www.ruby-forum.com/u/adam)\
**Post date:** [May 19, 2007, 2:52pm UTC](https://www.ruby-forum.com/t/how-to-get-flash-errors-to-display-in-edge/104557/1 "2007-05-19T14:52:42Z")

</div>

Hi

I have the following action, that generates a flash message if a blog is  
created,

how can I get this message to display in my views?

thanks

# 

```
# POST /blogs
# POST /blogs.xml
def create
    @blog = Blog.new(params[:blog])

    respond_to do |format|
        if @blog.save
            flash[:notice] = 'Blog was successfully created.'
            format.html { redirect_to blog_url(@blog) }
            format.xml { head :created, :location =>

```

blog\_url(@blog) }  
else  
format.html { render :action =\> “new” }  
format.xml { render :xml =\> @blog.errors.to\_xml }  
end  
end  
end

---

<div class="post-metadata">

**Author:** ![adam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://www.ruby-forum.com/u/adam)\
**Post date:** [May 19, 2007, 3:04pm UTC](https://www.ruby-forum.com/t/how-to-get-flash-errors-to-display-in-edge/104557/2 "2007-05-19T15:04:40Z")

</div>

On 5/19/07, adam [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> thanks  
> format.html { redirect\_to blog\_url(@blog) }  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Andrei M.  
[http://andreimaxim.ro](http://andreimaxim.ro)

---

<div class="post-metadata">

**Author:** ![adam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://www.ruby-forum.com/u/adam)\
**Post date:** [May 19, 2007, 3:17pm UTC](https://www.ruby-forum.com/t/how-to-get-flash-errors-to-display-in-edge/104557/3 "2007-05-19T15:17:57Z")

</div>

I understand that that should pass teh flash hash to the page view,  
however when I do somthing like this, nothing is displayed.

If the \<%if flash-%\> part is removed, an error is shown on most pages  
due to a nil object.

any suggestions?

\<%if flash-%\>  
\<%if flash[:notice] || flash[:alert] -%\>

\<%= flash[:notice] || flash[:alert] %\>

  
\<% end -%\>  
\<%end-%\>

Andrei M. wrote:

> On 5/19/07, adam [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > thanks  
> > format.html { redirect\_to blog\_url(@blog) }  
> > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> > 
> > >
> 
> –  
> Andrei M.  
> [http://andreimaxim.ro](http://andreimaxim.ro)
