Hi I''m tasked with upgrading an old app from 1.2.5 to 2.1.0. There is a basic image rotation triggered by a link_to_remote button. The image gets rotated by Mini-Magick, saved, and then the div is updated on the page to show the rotated image. This works fine in 1.2.5. In 2.1.0 it does not. The image is being rotated and saved because a refresh shows a rotated image. Furthermore, if I make the image_tag''s :title to be the image width (just to report something that should change for debugging) I see the new width of the rotated image when I hover over with the mouse. So it is being replaced but I''m not seeing it. Very odd since it works just fine in 1.2.5. Here are the code snippets: views/products/show.rhtml - <%= link_to_remote image_tag("arrow_turn_right.png"), :url => { :action => "rotate", :id => @show_pic } %> products_controller.rb - def rotate @show_pic = Asset.find_by_id(params[:id]) @show_pic.rotate(params[:dir]) @pics = @show_pic.product.images @show_pic.save! render :update do |page| page["product_pic"].replace_html :partial => ''photo'' page["asset_thumbs"].replace_html :partial => ''pic'', :collection => @pics end end _photo.rhtml - <%= image_tag(@show_pic.public_filename(:large), :width => ''300'', :alt => @show_pic.product.title + string_tags (@show_pic.product.tags), :title => @show_pic.width ) %> This does throw the following Ajax response in Firebug''s console: try { $("product_pic").update("\u003Cimg alt=\"acne \" src=\"/assets/ 0000/0001/IMG_0086_large.JPG?1233213603 \" title=\"3264\" width=\"300\" /\u003E\n\n"); $("asset_thumbs").update("\u003Cspan class=\"thumb\"\u003E\n\t\u003Ca href=\"/products/show?pic=1\"\u003E \u003Cimg alt=\"Img_0086_thumb\" border=\"1\" height=\"50\" src=\"/ assets/0000/0001/IMG_0086_thumb.JPG ?1233213601\" width=\"50\" /\u003E\u003C/a\u003E\n\u003C/span\u003E"); } catch (e) { alert(''RJS error:\n\n'' + e.toString()); alert(''$ (\"product_pic\").update(\"\\u003Cimg alt =\\\"acne \\\" src=\\\"/assets/0000/0001/IMG_0086_large.JPG?1233213603\ \\" title=\\\"3264\\\" width\\\"300\\\" /\\u003E\\n\\n\");\n$(\"asset_thumbs\").update(\"\ \u003Cspan class=\\\"thumb\\\"\\u003E\ \n\\t\\u003Ca href=\\\"/products/show?pic=1\\\"\\u003E\\u003Cimg alt=\\ \"Img_0086_thumb\\\" border=\ \\"1\\\" height=\\\"50\\\" src=\\\"/assets/0000/0001/ IMG_0086_thumb.JPG?1233213601\\\" width=\\\"50\ \\" /\\u003E\\u003C/a\\u003E\\n\\u003C/span\\u003E\");''); throw e } Any ideas? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thomas R. Koll
2009-Jan-29 16:56 UTC
Re: Strange replace_html image error going from 1.2.5 to 2.1.0
Hi Adeel, On Jan 29, 9:45 am, adeel <adeel...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi I''m tasked with upgrading an old app from 1.2.5 to 2.1.0. > > There is a basic image rotation triggered by a link_to_remote button. > The image gets rotated by Mini-Magick, saved, and then the div is > updated on the page to show the rotated image. This works fine in > 1.2.5. > .... > > Any ideas?Did you run a rake rails:update:scripts ? I suspect the prototype files have changed and trouble you now. About JS debugging, the error console (CMD-SHIFT-J on a Mac) will give you a lot more information than the Firebug console usually does (unless you configured it to do so). ciao, tom -- Thomas R. "TomK32" Koll <> http://ananasblau.com just a geek trying to change the world http://github.com/TomK32 --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
adeel
2009-Jan-29 17:48 UTC
Re: Strange replace_html image error going from 1.2.5 to 2.1.0
I just ran rake rails:update:scripts but to no avail. It updated a couple of scripts unrelated to prototype. It still does not update the rotated image. When I open the Firefox error console as you suggested, and I am seeing: Warning: Empty string passed to getElementById(). However this occurs even under 1.2.5 when it''s working so I think this is a red herring. Did something else change in Rails 2 for replacing objects? On Jan 29, 8:56 am, "Thomas R. Koll" <tom...-Mmb7MZpHnFY@public.gmane.org> wrote:> Hi Adeel, > > On Jan 29, 9:45 am, adeel <adeel...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi I''m tasked with upgrading an old app from 1.2.5 to 2.1.0. > > > There is a basic image rotation triggered by a link_to_remote button. > > The image gets rotated by Mini-Magick, saved, and then the div is > > updated on the page to show the rotated image. This works fine in > > 1.2.5. > > .... > > > Any ideas? > > Did you run a rake rails:update:scripts ? > I suspect the prototype files have changed and trouble you now. > > About JS debugging, the error console (CMD-SHIFT-J on a Mac) will > give you a lot more information than the Firebug console usually does > (unless you configured it to do so). > > ciao, tom > > -- > Thomas R. "TomK32" Koll <>http://ananasblau.com > just a geek trying to change the worldhttp://github.com/TomK32--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---