简体   繁体   English

Rails 5:从development.rb删除quiet_assets_path时出错

[英]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.

相关问题 修改后的config / environment / development.rb以能够连接到电子邮件服务器。 重新启动Rails服务器时,出现错误 - modified config/ environments/ development.rb to be able to connect to an email server. When I restart rails server I get an error Rails 3在config / environments / development.rb中从lib加载类的问题 - Rails 3 problem loading classes from lib in config/environments/development.rb 配置Rails以在development.rb中生成正确的第一行 - Configuring Rails to generate the correct first line in development.rb 没有development.rb的情况下如何运行Rails应用程序 - how is it possible to run a rails app without development.rb 将变量添加到config / development.rb rails引擎 - Adding Variables to config/development.rb rails engine 如何从gem中添加到应用程序的development.rb配置 - how to add to a application's development.rb config from in a gem 具有2个域的Rails应用程序:在initializers / devise.rb和environment / development.rb中定义2个SMTP? - Rails app with 2 domains: Define 2 SMTP's in initializers/devise.rb & environments/development.rb? 在development.rb中隐藏纯文本密码 - Hide Plain Text Password in development.rb 允许用户更改一部分development.rb - Allow a user to change part of the development.rb 找不到config / environments / development.rb命令 - config/environments/development.rb command not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM