srinivas muddana
2006-May-17 17:27 UTC
[Rails] send_data not working properly with link_remote_to
I''m reading an image in an link_to_remote call,and then using send_data
i send the read image as :type => "image/png" :disposition =>
"inline"...but when the div tag gets updated i see only ascii
characters
.....but if i do the same operation using normal call(link_to) i see it
functioning normal ....could someone explain .
my view:
<%= link_to_remote("flip",
:update => "img",
:url => {:action => "flip"}
)%>
<div id="img"></div>
controller:
def flip
filename="/public/picture/filename/1/scaler_1.jpg"
img=File.read(filename)
ilist = Magick::ImageList.new
@picture=ilist.from_blob(img)
@picthumb=@picture.flip!
@out=@picthumb.to_blob
send_data(@out,:filename =>''workshopimage'', :type =>
"image/png",
:disposition => "inline")
end
the above doesnt work
but with my view as
<%= link_to("flip",
:action => "flip"
)%>
it works....so doesnt it mean i need to do some thing more incase of an
ajax call ..am i missing something ..?
--
Posted via http://www.ruby-forum.com/.
