为什么这个类没有加载到生产模式但是处于开发模式? [重复]

时间:2023-01-16 09:44:08

This question already has an answer here:

这个问题在这里已有答案:

I'm having some differing behavior in my development and staging app. The same action that works locally gets this on staging (production env)

我在开发和暂存应用程序中有一些不同的行为。本地工作的相同操作在暂存(生产环境)时获得此操作

#<NameError: uninitialized constant #<Class:0x0000557d7c986aa8>::Report>
/app/app/models/cart.rb:26:in `add_product'
/app/app/controllers/cart_controller.rb:10:in `add_remove'
/app/vendor/bundle/ruby/2.3.0/gems/actionpack-5.2.0/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'

I don't really understand what is going on here. Perhaps a different RUBY_VERSION is loaded in the console on staging?

我真的不明白这里发生了什么。也许在登台时在控制台中加载了不同的RUBY_VERSION?

In my Gemfile I have:

在我的Gemfile中我有:

ruby '2.3.6'

UPDATE:

更新:

I've gone back and checked my local logs, and see that the errors there also show ruby 2.3.0:

我已经回去检查我的本地日志,并看到那里的错误也显示ruby 2.3.0:

/Users/myuser/.gem/ruby/2.3.0/gems/actionpack-5.2.0/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'

I'm clearly misunderstanding something. What am missing? Are gems always run from the lowest patch version of ruby?

我显然误解了一些事情。缺少什么?宝石总是从最低版本的ruby运行吗?

1 个解决方案

#1


1  

The folder ruby is installed on doesn't match the patch version. Only the minor.

安装的文件夹ruby与修补程序版本不匹配。只有未成年人。

The value RUBY_VERSION is the one you can trust.

值RUBY_VERSION是您可以信任的值。

#1


1  

The folder ruby is installed on doesn't match the patch version. Only the minor.

安装的文件夹ruby与修补程序版本不匹配。只有未成年人。

The value RUBY_VERSION is the one you can trust.

值RUBY_VERSION是您可以信任的值。