views:

21

answers:

0

I'm following part of this Railscast and trying to load a static file using Rack when a specific route is called:

match "/myApi.js" => lambda { |env| [200, {}, Rack::File.new("/v1/myApi.js")] }

No matter what I do, even if I just try to send a string through:

match "/myApi.js" => lambda { |env| [200, {}, "Hello World"] }

I still receive:

NoMethodError 

undefined method `body' for #<Rack::File:0x00000101edcea0 @root="/my/path">

How can I render a static file using rack?