Ruby on Rails 3机架中间件中,为何未定义方法`每个`引发问题?

2026-04-11 16:391阅读0评论SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计146个文字,预计阅读时间需要1分钟。

Ruby on Rails 3机架中间件中,为何未定义方法`每个`引发问题?

我想在框架中打印模板的主体。下面是我的设置……

我想用机架中间件打印模板的主体.下面是我的设置……

#config/initializers/response_timer.rb class ResponseTimer def initialize(app) @app = app end def call(env) status, headers, response = @app.call(env) [status, headers, response.body] end end #application.rb file config.middleware.use "ResponseTimer"

当我提出请求domainname / students /我收到以下错误.

undefined method `each' for #<String:0xd69a2e0>

请帮助.

Ruby on Rails 3机架中间件中,为何未定义方法`每个`引发问题?

我通过将[status,headers,response.body]更改为[status,headers,[response.body]]来解决我自己的问题,将response.body放在数组中.

本文共计146个文字,预计阅读时间需要1分钟。

Ruby on Rails 3机架中间件中,为何未定义方法`每个`引发问题?

我想在框架中打印模板的主体。下面是我的设置……

我想用机架中间件打印模板的主体.下面是我的设置……

#config/initializers/response_timer.rb class ResponseTimer def initialize(app) @app = app end def call(env) status, headers, response = @app.call(env) [status, headers, response.body] end end #application.rb file config.middleware.use "ResponseTimer"

当我提出请求domainname / students /我收到以下错误.

undefined method `each' for #<String:0xd69a2e0>

请帮助.

Ruby on Rails 3机架中间件中,为何未定义方法`每个`引发问题?

我通过将[status,headers,response.body]更改为[status,headers,[response.body]]来解决我自己的问题,将response.body放在数组中.