downloads failing in ruby 1.8.7+issues
I am including a pdf file card for download.
1. I add card and specified the file type and I select the file to upload to the server.
2. THe file is uploaded and I can see it on ther server.
3. However when I select the card it tries to upload it but I get a wagn Hitch.
4. I am ruby 1.8.7
5. I copied the exception stack below.
6. CODE I added ... Exception is in render_show_file
7. the error was in render_show_file in the application_controller. I put some print statements.
The params were empty. It is indeed null
def render_show_file
return fast_404 if !@card
@card.selected_rev_id = (@rev_id || @card.current_revision_id).to_i
format = @card.attachment_format(params[:format])
return fast_404 if !format
if ![format, 'file'].member?( params[:format] )
return redirect_to( request.fullpath.sub( /\.#{params[:format]}\b/, '.' + format ) ) #@card.attach.url(style) )
end
style = @card.attachment_style( @card.typecode, params[:size] || @style )
return fast_404 if !style
fileHandle = File.open("/tmp/mikesLog", "w")
fileHandle.puts "HELLO GOT TO HERE"
fileHandle.puts style
fileHandle.puts @card.inspect
fileHandle.close
send_file @card.attach.path(style),
:type => @card.attach_content_type,
:filename => "#{@card.cardname.to_url_key}#{style.blank? ? '' : '-'}#{style}.#{format}",
:x_sendfile => true,
:disposition => (params[:format]=='file' ? 'attachment' : 'inline' )
end