Forum: Ruby on Rails Error Handling on Ajax pages

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
84f3ccf15569999dc8fcc1da5e6306b2?d=identicon&s=25 MarcS (Guest)
on 2007-07-25 20:49
(Received via mailing list)

I'm having a problem with displaying errors on an Ajax page.
On the page users can upload images and when an image is uploaded it
will be added to the list of already uploaded images using

page.insert_html :bottom, "assets", :partial => 'assets/
list_item', :object => asset

The problem is that I don't really know how to display error messages
that occurred while uploading images (i.e. file to large, wrong
content type)

What I did right now is insert this in my controller

          format.js do
          responds_to_parent do
            render :update do |page|
              @asset.errors.each do |e|
                  page.notify  :error, e[0]+" "+e[1]

page.notify will then display the error message at the top of the

While this is working I would think that there's gotta be a prettier
way of doing this. Is there?

832ed6ace46d61032151f4e1864c057f?d=identicon&s=25 Solid (Guest)
on 2007-07-25 23:05
(Received via mailing list)
I'm using the:
page.replace_html :some_your_error_div_id, error_messages_for(:image)
This topic is locked and can not be replied to.