How to display an image in my view from a BLOB column?


#1

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 }
end

end

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 => @user.id.to_s +’-small.’+
@picture.extension, :type => @picture.extension, :disposition =>
‘inline’)

and in my view

but it seems to be wrong

thanks for your help