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?