Hyperstack部署问题:没有要加载的文件-models / application_record.rb(LoadError)

时间:2019-07-16 15:30:31

标签: ruby-on-rails hyperstack

我正在使用超级堆栈版本1.0.alpha1.4

我的应用程序在开发中运行良好,但是当我尝试在生产模式下部署它时,出现以下错误:

       /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:33:in `require': No such file to load -- models/application_record.rb (LoadError)
        from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
        from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
        from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
        from /app/app/models/application_record.rb:5:in `<top (required)>'
...

我该如何解决?预先谢谢你。

1 个答案:

答案 0 :(得分:1)

超级堆栈将application_record.rb文件放在app / hyperstack / models /下 与contnet:

class ApplicationRecord < ActiveRecord::Base
  self.abstract_class = true
  regulate_scope all: true
end

但在app / models下还需要一个application_record.rb,内容如下:

# app/models/application_record.rb
# the presence of this file prevents rails migrations from recreating application_record.rb
# see https://github.com/rails/rails/issues/29407

require 'models/application_record.rb'

这些文件是否存在?

生产与开发之间的主要区别还在于,在开发过程中,自动加载工作但必须对生产资产进行预编译。 您错过了这一步吗?