I''m using the:
page.replace_html :some_your_error_div_id, error_messages_for(:image)
On Jul 25, 9:49 pm, MarcS
<marcschue...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi,
>
> 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
>
> if @asset.save
> .......
> else
> format.js do
> responds_to_parent do
> render :update do |page|
> @asset.errors.each do |e|
> page.notify :error, e[0]+" "+e[1]
> end
> end
> end
> end
>
> page.notify will then display the error message at the top of the
> page.
>
> While this is working I would think that there''s gotta be a
prettier
> way of doing this. Is there?
>
> Marc
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---