I’ve been following a tutorial for Rails that goes through uploading
images directly to databases. The problem is that using image_tag keeps
automatically appending .png to the end of the address.
/classified/image/9 displays the image correctly, but the image
/classified/image/9.png keeps being added to the view instead.
Thanks in advance!
classified_controller.rb:
…
def image
@image = Classified.find(params[:id])
send_data @image.picture, :filename => “pic.jpg”,
:type => @image.content_type, :disposition => “inline”
end
…
show.rhtml:
…
<% unless @classified.picture.blank? %>
<%= image_tag(url_for({:action => ‘image’, :id => @classified.id})) -%>
<% end %>
…