Displaying an image from the database.

Can someone help me display an image from a database?

I am trying to create an image tag for an image located in a database. The following action is located in the show_photo_controller.

def database_data     @photo = Photo.find(params[:id])     send_data(@photo.data,                 :filename => @photo.name,                 :type => @photo.content_type,                 :disposition => "inline") end

If I go to the url http://localhost:3000/show_photo/database_data/1, the photo displays properly. However, when I insert the following in my view, it displays the image's binary as text. Suggestions?

<%= image_tag("/show_photo/database_data/1", :alt => "Image") %>

I've also pasted my code at Parked at Loopia. Thanks!

Great! <%= image_tag("/show_photo/database_data?id=1", :alt => "Image") %> worked! Thanks!