FloWe
FloWe

Reputation: 11

Download Blob file in Rails App is shown inline and not attached

I get a blob from a function in my oracle Datenbank. Users of my Rails App should be able to download these BLOB. My Problem is, that after clicking on download, the BLOB file is shown inline in the browser, but it should be download as a file.

link:

= link_to export_pldw_plausibility_path, :class => "btn btn-primary 
    action-button" do
    %span.glyphicon.glyphicon-pencil
    %span.hidden-xs
= "Export"

route:

resources :pldw_plausibilities do
  get 'export', on: :member
end

controller:

def export
  send_data PldwPlausibility.export(params[:id]), :filename => "test.BLOB", 
   :disposition => 'attachment'
end

Model:

def self.export(id)
  return plsql.pld.pld_mdc.exportMDOC('PLD_PLAUSIBILITY', id.to_i)
end

Screenshot

Upvotes: 0

Views: 256

Answers (1)

FloWe
FloWe

Reputation: 11

Sorry!

Adding :target => "_blank" to the link solves this Problem..

Upvotes: 1

Related Questions