Hey everyone,
I've got a basic setup via an apache2 server, virtualhost ect. At the moment I'm just trying to use the send_file function of rails (actionpack I believe?) but it continues to error out. Here is the breakdown:
#Controller#
class Misc < ApplicationController
def stuff send_file("#{RAILS_ROOT}/downloads/test.txt") end
end
#View#
<% a = Misc.new %> <p><%= a.stuff %></p>
And this is the error I've been getting:
You have a nil object when you didn't expect it! The error occurred while evaluating nil.update
Extracted source (around line #3):
2: <% a = Misc.new %> 3: <p><%= a.stuff %></p>
Trace yields the following:
vendor/rails/actionpack/lib/action_controller/streaming.rb:139:in `send_file_headers!' vendor/rails/actionpack/lib/action_controller/streaming.rb:72:in `send_file' app/controllers/home_controller.rb:16:in `stuff' app/views/home/index.html.erb:3:in `_run_erb_47app47views47home47index46html46erb'
Any suggestions?
*one thing i will note, dunno if it matters, is that rails 2.3.5 wouldnt install - kept complaining about rack 1.0.0 runtime, so instead i installed all the packages and dependencies separately via apt-get install actionpack -v=2.3.4 ect ect, using 2.3.4 instead*
Thanks!
-Regards Mac