Retrieving Blob data

Hi,

I have stored a pdf file as BLOB in the database. How can I
display it inline (:disposition => ‘inline’) by clicking on
a link in a view?

Thanks,
Ram.

Just pass the ID of that row where you stored that pdf

<%= url_for(:action => ‘index’, :id => @pdf.id) %>

Ram wrote:

Hi,

I have stored a pdf file as BLOB in the database. How can I
display it inline (:disposition => ‘inline’) by clicking on
a link in a view?

Thanks,
Ram.

#controller
def pdf
@doc = MyDocument.find(params[:id])
send_data @doc.pdf,
:disposition => “inline”,
:type => “application/pdf”
end

#view
<%= link_to “PDF”, :action => “pdf”, :id => @doc %>