我想尝试一个简单的机架中间件"hello world",但我似乎陷入困境.看起来主要的sytax发生了变化,因为一些例子使用了这段代码:
require 'rack/utils'
class FooBar
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
body.body << "\nHi from #{self.class}"
[status, headers, body]
end
end
Run Code Online (Sandbox Code Playgroud)
产生错误:
undefined method `<<' for #<ActionDispatch::Response:0x103f07c48>
Run Code Online (Sandbox Code Playgroud)
即使我看到那里的其他代码,我似乎无法使用rails 3.0.3运行它们.
这是我的具体问题:
非常感谢!