The following code should work. In your controller, create a method:
def show_image
@user = User.find(params[:id])
send_data @user.image, :type => 'image/png',:disposition => 'inline'
end
In your view:
<%= image_tag url_for(:controller => "mycontroller", :action => "show_image", :id => @user.id) %>
I would recommend using the Paperclip gem. It makes saving/viewing of images really easy.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…