TypeError in ContentsController#download_question

no implicit conversion of nil into String

Extracted source (around line #40):
38
39
40
41
42
43
          
data = Question.find(params[:id])
if params[:mode] == "download"
send_file data.file.current_path, :type => "application/pdf", :disposition => 'attachment', :filename => "question_#{data.id}_#{Time.now.to_i}.pdf"
else
send_file data.file.current_path, :type => "application/pdf", :disposition => 'inline', :filename => "question_#{data.id}_#{Time.now.to_i}.pdf"
end

Rails.root: /home/itf/robocon

Application Trace | Framework Trace | Full Trace
app/controllers/contents_controller.rb:40:in `download_question'

Request

Parameters:

{"id"=>"15",
 "mode"=>"download"}

Response

Headers:

None