Forum: Ruby on Rails what shoud flash[:alert] be in edge rails?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
josh (Guest)
on 2007-05-02 22:53
Hi

I haveJust attmpting to start using edge rails for the first time.

Couldnt find the answer to this anywhere, below is a small peiece of
code I have been using, but flash[:notice] does not seem to work anymore

What should i be using instead?

%if flash[:notice] || flash[:alert] -%>
    <p id="flashMessage" class="message <%= flash[:notice] ? 'good' :
'bad' -%>">
        <%= flash[:notice] || flash[:alert] %>
    </p>
<% end -%>

cheers
Jason R. (Guest)
on 2007-05-02 23:35
(Received via mailing list)
flash is just a hash. Rails doesn't do anything specific if there's a
key
named :notice. There's something else wrong with your code. Can we see
the
related controller?

Jason
josh (Guest)
on 2007-05-02 23:52
Jason R. wrote:
> flash is just a hash. Rails doesn't do anything specific if there's a
> key
> named :notice. There's something else wrong with your code. Can we see
> the
> related controller?
>
> Jason

This is the code from one of the broken controllers
#
    # POST /blogs
    # POST /blogs.xml
    def create
        @blog = Blog.new(params[:blog])

        respond_to do |format|
            if @blog.save

                flash[:notice] = 'Blog post 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
This topic is locked and can not be replied to.