[英]Rails 5: Error when removed quiet_assets_path from development.rb
I have been trying to upgrade my app from Rails 4 to Rails 5. In my Rails 4 version I have quiet_assets_path set but in Rails 5 it is not required. 我一直在尝试将我的应用程序从Rails 4升级到Rails5。在我的Rails 4版本中,我设置了quiet_assets_path,但是在Rails 5中不是必需的。 But when I removed that tried to start the server I am getting the following error, 但是,当我删除尝试启动服务器的尝试时,出现以下错误,
> ruby-2.2.2/gems/rack-mini-profiler-0.10.2/lib/mini_profiler_rails/railtie.rb:93:in
> `>': comparison of Fixnum with nil failed (ArgumentError) from
> /Users/Admin/.rvm/gems/ruby-2.2.2/gems/rack-mini-profiler-0.10.2/lib/mini_profiler_rails/railtie.rb:93:in
> `block in <class:Railtie>'
Can someone help me with this? 有人可以帮我弄这个吗?
Edit: 编辑:
Following is my rack_profiler.rb, 以下是我的rack_profiler.rb,
if Rails.env.development? || Rails.env.production?
require 'rack-mini-profiler'
# initialization is skipped so trigger it
Rack::MiniProfilerRails.initialize!(Rails.application)
Rack::MiniProfiler.config.skip_schema_queries = true
Rack::MiniProfiler.config.skip_paths += %w(/admin/sidekiq)
Rails.application.middleware.delete(Rack::MiniProfiler)
Rails.application.middleware.insert_after(Rack::Deflater, Rack::MiniProfiler)
end
When I comment the delete line then server is starting but if the line uncommented then the server breaks. 当我注释删除行时,服务器正在启动,但是如果该行未注释,则服务器中断。
thanks for the update. 感谢更新。 First of all, do you use Rack::Deflater
middleware in development
environment too? 首先,您是否还在development
环境中使用Rack::Deflater
中间件?
I think this issue might help you. 我认为这个问题可能对您有帮助。 It basically says that in Rails all delete middleware operations are issued at the end . 基本上说,在Rails中,所有删除中间件操作都在最后发出 。 You can use the swap
method as described in the above issue. 您可以使用上述问题中所述的swap
方法。
If you search the repo issues for "Deflater" you'll find a lot of results, but I believe the above contains your fix. 如果搜索“ Deflater”的回购问题,您会发现很多结果,但我相信以上内容已包含您的修复程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.