0

我正在使用超堆栈版本 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)>'
...

我该如何解决这个问题?先感谢您。

4

1 回答 1

1

Hyperstack 在 app/hyperstack/models/ 下放置一个 application_record.rb 文件,并带有 contnets:

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'

这些文件存在吗?

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

于 2019-07-16T21:36:42.797 回答