Forum: Ruby on Rails How to display an image in my view from a BLOB column ?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Kad K. (Guest)
on 2007-07-04 13:16
I have a model  'Picture' with a blob column 'small'  and a string
column 'extension'

in my PictureController , I want to show it in the show view

my show action is quite simple

  def show
    @user = User.find(params[:user_id])
    @picture = @user.picture

    respond_to do |format|
      format.html # show.rhtml
      format.xml  { render :xml => @picture.to_xml }

what should I write in my show.rhtml view to display it ?

 I thought to add  in my show action
   send_data(@picture.small, :filename => +'-small.'+
@picture.extension, :type => @picture.extension, :disposition =>

and in my view
<img src="<%= +'-small.'+ @picture.extension  %>" />

but it seems to be wrong

thanks for your help
This topic is locked and can not be replied to.