AdapterNotSpecified 使用 ClearDB 将 Rails 应用程序部署到 Heroku MySQL
AdapterNotSpecified deploying Rails app to Heroku using ClearDB for MySQL
我正在尝试恢复我几年前开发的旧 Rails 应用程序。我在 Heroku-16 堆栈上使用 ruby 2.3.3 和 rails 3.2.15,我的 MySQL 数据库和 mysql2 适配器使用 ClearDB。部署到 Heroku 时,部署成功,但在尝试启动应用程序时崩溃。
来自 Heroku 日志的完整堆栈跟踪(根据第一个答案中的建议修复 activerecord-import gem 版本后更新):
2021-02-09T04:42:26.851155+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2021-02-09T04:42:27.370829+00:00 app[web.1]: Exiting
2021-02-09T04:42:30.584256+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:17:in `<module:ClassMethods>': undefined method `version' for ActiveModel:Module (NoMethodError)
2021-02-09T04:42:30.584311+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:6:in `<module:ActiveRecord>'
2021-02-09T04:42:30.584336+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:3:in `<module:ORM>'
2021-02-09T04:42:30.584380+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:2:in `<module:ValidatesTimeliness>'
2021-02-09T04:42:30.584424+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:1:in `<top (required)>'
2021-02-09T04:42:30.584467+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require'
2021-02-09T04:42:30.584499+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `block in require'
2021-02-09T04:42:30.584532+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:236:in `load_dependency'
2021-02-09T04:42:30.584595+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require'
2021-02-09T04:42:30.584621+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness.rb:59:in `block in load_orms'
2021-02-09T04:42:30.584647+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness.rb:59:in `each'
2021-02-09T04:42:30.584674+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness.rb:59:in `load_orms'
2021-02-09T04:42:30.584701+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/railtie.rb:7:in `block (2 levels) in <class:Railtie>'
2021-02-09T04:42:30.584758+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
2021-02-09T04:42:30.584787+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
2021-02-09T04:42:30.584813+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:26:in `block in on_load'
2021-02-09T04:42:30.584843+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:25:in `each'
2021-02-09T04:42:30.584924+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
2021-02-09T04:42:30.584985+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/railtie.rb:4:in `block in <class:Railtie>'
2021-02-09T04:42:30.585018+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:30:in `instance_exec'
2021-02-09T04:42:30.585058+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:30:in `run'
2021-02-09T04:42:30.585108+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:55:in `block in run_initializers'
2021-02-09T04:42:30.585158+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:54:in `each'
2021-02-09T04:42:30.585189+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:54:in `run_initializers'
2021-02-09T04:42:30.585220+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/application.rb:136:in `initialize!'
2021-02-09T04:42:30.585255+00:00 app[web.1]: from /app/config/environment.rb:6:in `<top (required)>'
2021-02-09T04:42:30.585334+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require'
2021-02-09T04:42:30.585368+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `block in require'
2021-02-09T04:42:30.585401+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:236:in `load_dependency'
2021-02-09T04:42:30.585432+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require'
2021-02-09T04:42:30.585511+00:00 app[web.1]: from /app/config.ru:3:in `block in <main>'
2021-02-09T04:42:30.585548+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:51:in `instance_eval'
2021-02-09T04:42:30.585579+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:51:in `initialize'
2021-02-09T04:42:30.585659+00:00 app[web.1]: from /app/config.ru:in `new'
2021-02-09T04:42:30.585692+00:00 app[web.1]: from /app/config.ru:in `<main>'
2021-02-09T04:42:30.585723+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:40:in `eval'
2021-02-09T04:42:30.585764+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:40:in `parse_file'
2021-02-09T04:42:30.585837+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/server.rb:200:in `app'
2021-02-09T04:42:30.585868+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands/server.rb:46:in `app'
2021-02-09T04:42:30.585900+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/server.rb:304:in `wrapped_app'
2021-02-09T04:42:30.585930+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/server.rb:254:in `start'
2021-02-09T04:42:30.585977+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands/server.rb:70:in `start'
2021-02-09T04:42:30.586026+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands.rb:55:in `block in <top (required)>'
2021-02-09T04:42:30.586055+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands.rb:50:in `tap'
2021-02-09T04:42:30.586087+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands.rb:50:in `<top (required)>'
2021-02-09T04:42:30.586120+00:00 app[web.1]: from script/rails:6:in `require'
2021-02-09T04:42:30.588043+00:00 app[web.1]: from script/rails:6:in `<main>'
2021-02-09T04:42:30.758954+00:00 heroku[web.1]: Process exited with status 1
2021-02-09T04:42:30.840167+00:00 heroku[web.1]: State changed from starting to crashed
堆栈跟踪中引用的 environment.rb 的第 6 行:
Rails.application.initialize!
Heroku 配置变量:
CLEARDB_DATABASE_URL: mysql2://user:pw@us-cdbr-east-03.cleardb.com/db?reconnect=true
DATABASE_URL: mysql2://user:pw@us-cdbr-east-03.cleardb.com/db?reconnect=true
RACK_ENV: production
RAILS_ENV: production
LANG: en_US.UTF-8
来自 database.yml:
production:
url: <%= ENV['DATABASE_URL'] %>
adapter: mysql2
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
来自Gemfile.lock:
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.15)
actionpack (= 3.2.15)
mail (~> 2.5.4)
actionpack (3.2.15)
activemodel (= 3.2.15)
activesupport (= 3.2.15)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.15)
activesupport (= 3.2.15)
builder (~> 3.0.0)
activerecord (3.2.15)
activemodel (= 3.2.15)
activesupport (= 3.2.15)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activerecord-import (0.4.1)
activerecord (>= 3.0)
activeresource (3.2.15)
activemodel (= 3.2.15)
activesupport (= 3.2.15)
activesupport (3.2.15)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
addressable (2.3.4)
akami (1.2.0)
gyoku (>= 0.4.0)
nokogiri (>= 1.4.0)
arel (3.0.2)
atomic (1.1.14)
attr_encrypted (1.2.1)
encryptor (>= 1.1.1)
audited (3.0.0)
audited-activerecord (3.0.0)
activerecord (~> 3.0)
audited (= 3.0.0)
axlsx (2.0.1)
htmlentities (~> 4.3.1)
nokogiri (>= 1.4.1)
rubyzip (~> 1.0.0)
axlsx_rails (0.3.0)
axlsx (>= 2.0.1)
rails (>= 3.1)
bcrypt-ruby (3.1.2)
bcrypt-ruby (3.1.2-x86-mingw32)
better_errors (0.8.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
builder (3.0.4)
bumbler (0.3.1)
byebug (5.0.0)
columnize (= 0.9.0)
capistrano (2.15.5)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
capistrano-ext (1.2.1)
capistrano (>= 1.0.0)
capistrano-log_with_awesome (0.0.2)
capistrano (>= 2.5.14)
capistrano-sidekiq (0.5.3)
capistrano
sidekiq
capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
celluloid (0.16.0)
timers (~> 4.0.0)
childprocess (0.5.6)
ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (0.0.7)
nokogiri
chronic (0.10.2)
climate_control (0.0.3)
activesupport (>= 3.0)
cocaine (0.5.3)
climate_control (>= 0.0.3, < 1.0)
coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
columnize (0.9.0)
connection_pool (2.2.0)
crack (0.4.2)
safe_yaml (~> 1.0.0)
curb (0.9.7)
d3-rails (3.5.5)
railties (>= 3.1)
database_cleaner (1.0.1)
debug_inspector (0.0.2)
devise (3.1.1)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
devise_security_extension (0.7.2)
devise (>= 2.0.0)
rails (>= 3.1.1)
diff-lcs (1.2.5)
encryptor (1.1.3)
erubis (2.7.0)
execjs (2.0.2)
factory_girl (4.5.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.5.0)
factory_girl (~> 4.5.0)
railties (>= 3.0.0)
faker (1.1.2)
i18n (~> 0.5)
ffi (1.9.10)
ffi (1.9.10-x86-mingw32)
font-awesome-rails (4.3.0.0)
railties (>= 3.2, < 5.0)
gpgme (2.0.2)
gyoku (1.1.0)
builder (>= 2.1.2)
handlebars_assets (0.20.2)
execjs (~> 2.0)
multi_json (~> 1.0)
sprockets (>= 2.0.0, < 4.0)
tilt (~> 1.2)
hashie (3.4.1)
highline (1.6.20)
hike (1.2.3)
hitimes (1.2.2)
hitimes (1.2.2-x86-mingw32)
htmlentities (4.3.4)
httpi (2.1.0)
rack
rubyntlm (~> 0.3.2)
i18n (0.7.0)
imgkit (1.6.1)
journey (1.0.4)
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
kaminari (0.14.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
launchy (2.4.3)
addressable (~> 2.3)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
meta_request (0.2.3)
rack-contrib
railties
mime-types (1.25)
multi_json (1.11.2)
mysql2 (0.3.17)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.7.0)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
newrelic_rpm (3.13.0.299)
nguyen (1.0.1)
nokogiri (~> 1.5.6)
nokogiri (1.5.10)
nokogiri (1.5.10-x86-mingw32)
nori (2.3.0)
orm_adapter (0.4.0)
paperclip (3.5.2)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
polyglot (0.3.3)
rack (1.4.7)
rack-cache (1.2)
rack (>= 0.4)
rack-contrib (1.1.0)
rack (>= 0.9.1)
rack-protection (1.5.3)
rack
rack-ssl (1.3.4)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (3.2.15)
actionmailer (= 3.2.15)
actionpack (= 3.2.15)
activerecord (= 3.2.15)
activeresource (= 3.2.15)
activesupport (= 3.2.15)
bundler (~> 1.0)
railties (= 3.2.15)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (3.2.15)
actionpack (= 3.2.15)
activesupport (= 3.2.15)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.4.2)
rdoc (3.12.2)
json (~> 1.4)
redis (3.2.1)
redis-namespace (1.5.2)
redis (~> 3.0, >= 3.0.4)
rolify (3.2.0)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.4)
rspec-rails (2.14.1)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
ruby-ole (1.2.11.7)
rubyXL (3.1.0)
nokogiri (>= 1.4.4)
rubyzip (>= 1.0.0)
rubyntlm (0.3.4)
rubyzip (1.0.0)
rvm-capistrano (1.5.1)
capistrano (~> 2.15.4)
safe_yaml (1.0.4)
sass (3.2.12)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
savon (2.3.0)
akami (~> 1.2.0)
builder (>= 2.1.2)
gyoku (~> 1.1.0)
httpi (~> 2.1.0)
nokogiri (>= 1.4.0, < 1.6)
nori (~> 2.3.0)
wasabi (~> 3.2.0)
selenium-webdriver (2.46.2)
childprocess (~> 0.5)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0)
shoulda-matchers (2.2.0)
activesupport (>= 3.0.0)
sidekiq (3.4.2)
celluloid (~> 0.16.0)
connection_pool (~> 2.2, >= 2.2.0)
json (~> 1.0)
redis (~> 3.2, >= 3.2.1)
redis-namespace (~> 1.5, >= 1.5.2)
sidekiq-failures (0.4.5)
sidekiq (>= 2.16.0)
sinatra (1.4.6)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
soda-ruby (0.2.13)
hashie
spreadsheet (0.9.4)
ruby-ole (>= 1.0)
spring (1.3.6)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (2.2.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
teaspoon (1.0.2)
railties (>= 3.2.5, < 5)
teaspoon-mocha (2.2.4)
teaspoon (>= 1.0.0)
thor (0.19.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
timeliness (0.3.7)
timers (4.0.1)
hitimes
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.38)
uglifier (2.2.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
validates_timeliness (3.0.14)
timeliness (~> 0.3.6)
vcr (2.9.3)
warden (1.2.3)
rack (>= 1.0)
wasabi (3.2.0)
httpi (~> 2.0)
nokogiri (>= 1.4.0, < 1.6)
wash_out (0.8.4)
nori (>= 2.0.0)
webmock (1.17.4)
addressable (>= 2.2.7)
crack (>= 0.3.2)
websocket (1.2.2)
whenever (0.8.4)
activesupport (>= 2.3.4)
chronic (>= 0.6.3)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
x86-mingw32
DEPENDENCIES
activerecord-import (= 0.4.1)
addressable
attr_encrypted
audited-activerecord (~> 3.0)
axlsx_rails (= 0.3.0)
better_errors
binding_of_caller
bumbler
bundler
byebug
capistrano
capistrano-ext
capistrano-sidekiq
capistrano-slack!
capybara
chromedriver-helper
coffee-rails (~> 3.2.1)
curb (= 0.9.7)
d3-rails
database_cleaner
devise
devise_security_extension
factory_girl_rails
faker
font-awesome-rails
gpgme
handlebars_assets
imgkit
jquery-rails
kaminari
launchy
meta_request (= 0.2.3)
mysql2 (= 0.3.17)
newrelic_rpm
nguyen
paperclip
rails (~> 3.2.14)
rails_12factor
rolify
rspec-expectations
rspec-rails
rubyXL
rvm-capistrano
sass-rails (~> 3.2.3)
savon
selenium-webdriver
shoulda-matchers
sidekiq
sidekiq-failures
sinatra
soda-ruby
spreadsheet
spring
spring-commands-rspec
teaspoon-mocha
uglifier (>= 1.0.3)
validates_timeliness
vcr
wash_out
webmock
whenever
wkhtmltoimage-binary!
RUBY VERSION
ruby 2.3.3p222
BUNDLED WITH
1.17.3
我一整天都在为此苦苦思索,阅读了我能找到的所有 Stack Overflow 和支持文章,但还没弄清楚我的配置哪里出了问题。
在撰写本文时(2020 年 10 月发布)与 activerecord 3.2 一起尝试使用最新版本的 activerecord-import gem 时,您似乎 运行 遇到了兼容性问题.22.5(2016 年 9 月发布)。你确实提到它是一个 rails 3.2.15 应用程序,但你没有使用令人困惑的 activerecord 3.2.15。
尝试使用 activerecord-import 0.4.1(2013 年 7 月发布)和 activerecord 3.2.15 应该与 rails 3.2.15.
我正在尝试恢复我几年前开发的旧 Rails 应用程序。我在 Heroku-16 堆栈上使用 ruby 2.3.3 和 rails 3.2.15,我的 MySQL 数据库和 mysql2 适配器使用 ClearDB。部署到 Heroku 时,部署成功,但在尝试启动应用程序时崩溃。
来自 Heroku 日志的完整堆栈跟踪(根据第一个答案中的建议修复 activerecord-import gem 版本后更新):
2021-02-09T04:42:26.851155+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2021-02-09T04:42:27.370829+00:00 app[web.1]: Exiting
2021-02-09T04:42:30.584256+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:17:in `<module:ClassMethods>': undefined method `version' for ActiveModel:Module (NoMethodError)
2021-02-09T04:42:30.584311+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:6:in `<module:ActiveRecord>'
2021-02-09T04:42:30.584336+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:3:in `<module:ORM>'
2021-02-09T04:42:30.584380+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:2:in `<module:ValidatesTimeliness>'
2021-02-09T04:42:30.584424+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:1:in `<top (required)>'
2021-02-09T04:42:30.584467+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require'
2021-02-09T04:42:30.584499+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `block in require'
2021-02-09T04:42:30.584532+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:236:in `load_dependency'
2021-02-09T04:42:30.584595+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require'
2021-02-09T04:42:30.584621+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness.rb:59:in `block in load_orms'
2021-02-09T04:42:30.584647+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness.rb:59:in `each'
2021-02-09T04:42:30.584674+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness.rb:59:in `load_orms'
2021-02-09T04:42:30.584701+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/railtie.rb:7:in `block (2 levels) in <class:Railtie>'
2021-02-09T04:42:30.584758+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
2021-02-09T04:42:30.584787+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
2021-02-09T04:42:30.584813+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:26:in `block in on_load'
2021-02-09T04:42:30.584843+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:25:in `each'
2021-02-09T04:42:30.584924+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
2021-02-09T04:42:30.584985+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/railtie.rb:4:in `block in <class:Railtie>'
2021-02-09T04:42:30.585018+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:30:in `instance_exec'
2021-02-09T04:42:30.585058+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:30:in `run'
2021-02-09T04:42:30.585108+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:55:in `block in run_initializers'
2021-02-09T04:42:30.585158+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:54:in `each'
2021-02-09T04:42:30.585189+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:54:in `run_initializers'
2021-02-09T04:42:30.585220+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/application.rb:136:in `initialize!'
2021-02-09T04:42:30.585255+00:00 app[web.1]: from /app/config/environment.rb:6:in `<top (required)>'
2021-02-09T04:42:30.585334+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require'
2021-02-09T04:42:30.585368+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `block in require'
2021-02-09T04:42:30.585401+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:236:in `load_dependency'
2021-02-09T04:42:30.585432+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require'
2021-02-09T04:42:30.585511+00:00 app[web.1]: from /app/config.ru:3:in `block in <main>'
2021-02-09T04:42:30.585548+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:51:in `instance_eval'
2021-02-09T04:42:30.585579+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:51:in `initialize'
2021-02-09T04:42:30.585659+00:00 app[web.1]: from /app/config.ru:in `new'
2021-02-09T04:42:30.585692+00:00 app[web.1]: from /app/config.ru:in `<main>'
2021-02-09T04:42:30.585723+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:40:in `eval'
2021-02-09T04:42:30.585764+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:40:in `parse_file'
2021-02-09T04:42:30.585837+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/server.rb:200:in `app'
2021-02-09T04:42:30.585868+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands/server.rb:46:in `app'
2021-02-09T04:42:30.585900+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/server.rb:304:in `wrapped_app'
2021-02-09T04:42:30.585930+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/server.rb:254:in `start'
2021-02-09T04:42:30.585977+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands/server.rb:70:in `start'
2021-02-09T04:42:30.586026+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands.rb:55:in `block in <top (required)>'
2021-02-09T04:42:30.586055+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands.rb:50:in `tap'
2021-02-09T04:42:30.586087+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands.rb:50:in `<top (required)>'
2021-02-09T04:42:30.586120+00:00 app[web.1]: from script/rails:6:in `require'
2021-02-09T04:42:30.588043+00:00 app[web.1]: from script/rails:6:in `<main>'
2021-02-09T04:42:30.758954+00:00 heroku[web.1]: Process exited with status 1
2021-02-09T04:42:30.840167+00:00 heroku[web.1]: State changed from starting to crashed
堆栈跟踪中引用的 environment.rb 的第 6 行:
Rails.application.initialize!
Heroku 配置变量:
CLEARDB_DATABASE_URL: mysql2://user:pw@us-cdbr-east-03.cleardb.com/db?reconnect=true
DATABASE_URL: mysql2://user:pw@us-cdbr-east-03.cleardb.com/db?reconnect=true
RACK_ENV: production
RAILS_ENV: production
LANG: en_US.UTF-8
来自 database.yml:
production:
url: <%= ENV['DATABASE_URL'] %>
adapter: mysql2
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
来自Gemfile.lock:
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.15)
actionpack (= 3.2.15)
mail (~> 2.5.4)
actionpack (3.2.15)
activemodel (= 3.2.15)
activesupport (= 3.2.15)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.15)
activesupport (= 3.2.15)
builder (~> 3.0.0)
activerecord (3.2.15)
activemodel (= 3.2.15)
activesupport (= 3.2.15)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activerecord-import (0.4.1)
activerecord (>= 3.0)
activeresource (3.2.15)
activemodel (= 3.2.15)
activesupport (= 3.2.15)
activesupport (3.2.15)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
addressable (2.3.4)
akami (1.2.0)
gyoku (>= 0.4.0)
nokogiri (>= 1.4.0)
arel (3.0.2)
atomic (1.1.14)
attr_encrypted (1.2.1)
encryptor (>= 1.1.1)
audited (3.0.0)
audited-activerecord (3.0.0)
activerecord (~> 3.0)
audited (= 3.0.0)
axlsx (2.0.1)
htmlentities (~> 4.3.1)
nokogiri (>= 1.4.1)
rubyzip (~> 1.0.0)
axlsx_rails (0.3.0)
axlsx (>= 2.0.1)
rails (>= 3.1)
bcrypt-ruby (3.1.2)
bcrypt-ruby (3.1.2-x86-mingw32)
better_errors (0.8.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
builder (3.0.4)
bumbler (0.3.1)
byebug (5.0.0)
columnize (= 0.9.0)
capistrano (2.15.5)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
capistrano-ext (1.2.1)
capistrano (>= 1.0.0)
capistrano-log_with_awesome (0.0.2)
capistrano (>= 2.5.14)
capistrano-sidekiq (0.5.3)
capistrano
sidekiq
capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
celluloid (0.16.0)
timers (~> 4.0.0)
childprocess (0.5.6)
ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (0.0.7)
nokogiri
chronic (0.10.2)
climate_control (0.0.3)
activesupport (>= 3.0)
cocaine (0.5.3)
climate_control (>= 0.0.3, < 1.0)
coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
columnize (0.9.0)
connection_pool (2.2.0)
crack (0.4.2)
safe_yaml (~> 1.0.0)
curb (0.9.7)
d3-rails (3.5.5)
railties (>= 3.1)
database_cleaner (1.0.1)
debug_inspector (0.0.2)
devise (3.1.1)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
devise_security_extension (0.7.2)
devise (>= 2.0.0)
rails (>= 3.1.1)
diff-lcs (1.2.5)
encryptor (1.1.3)
erubis (2.7.0)
execjs (2.0.2)
factory_girl (4.5.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.5.0)
factory_girl (~> 4.5.0)
railties (>= 3.0.0)
faker (1.1.2)
i18n (~> 0.5)
ffi (1.9.10)
ffi (1.9.10-x86-mingw32)
font-awesome-rails (4.3.0.0)
railties (>= 3.2, < 5.0)
gpgme (2.0.2)
gyoku (1.1.0)
builder (>= 2.1.2)
handlebars_assets (0.20.2)
execjs (~> 2.0)
multi_json (~> 1.0)
sprockets (>= 2.0.0, < 4.0)
tilt (~> 1.2)
hashie (3.4.1)
highline (1.6.20)
hike (1.2.3)
hitimes (1.2.2)
hitimes (1.2.2-x86-mingw32)
htmlentities (4.3.4)
httpi (2.1.0)
rack
rubyntlm (~> 0.3.2)
i18n (0.7.0)
imgkit (1.6.1)
journey (1.0.4)
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
kaminari (0.14.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
launchy (2.4.3)
addressable (~> 2.3)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
meta_request (0.2.3)
rack-contrib
railties
mime-types (1.25)
multi_json (1.11.2)
mysql2 (0.3.17)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.7.0)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
newrelic_rpm (3.13.0.299)
nguyen (1.0.1)
nokogiri (~> 1.5.6)
nokogiri (1.5.10)
nokogiri (1.5.10-x86-mingw32)
nori (2.3.0)
orm_adapter (0.4.0)
paperclip (3.5.2)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
polyglot (0.3.3)
rack (1.4.7)
rack-cache (1.2)
rack (>= 0.4)
rack-contrib (1.1.0)
rack (>= 0.9.1)
rack-protection (1.5.3)
rack
rack-ssl (1.3.4)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (3.2.15)
actionmailer (= 3.2.15)
actionpack (= 3.2.15)
activerecord (= 3.2.15)
activeresource (= 3.2.15)
activesupport (= 3.2.15)
bundler (~> 1.0)
railties (= 3.2.15)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (3.2.15)
actionpack (= 3.2.15)
activesupport (= 3.2.15)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.4.2)
rdoc (3.12.2)
json (~> 1.4)
redis (3.2.1)
redis-namespace (1.5.2)
redis (~> 3.0, >= 3.0.4)
rolify (3.2.0)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.4)
rspec-rails (2.14.1)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
ruby-ole (1.2.11.7)
rubyXL (3.1.0)
nokogiri (>= 1.4.4)
rubyzip (>= 1.0.0)
rubyntlm (0.3.4)
rubyzip (1.0.0)
rvm-capistrano (1.5.1)
capistrano (~> 2.15.4)
safe_yaml (1.0.4)
sass (3.2.12)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
savon (2.3.0)
akami (~> 1.2.0)
builder (>= 2.1.2)
gyoku (~> 1.1.0)
httpi (~> 2.1.0)
nokogiri (>= 1.4.0, < 1.6)
nori (~> 2.3.0)
wasabi (~> 3.2.0)
selenium-webdriver (2.46.2)
childprocess (~> 0.5)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0)
shoulda-matchers (2.2.0)
activesupport (>= 3.0.0)
sidekiq (3.4.2)
celluloid (~> 0.16.0)
connection_pool (~> 2.2, >= 2.2.0)
json (~> 1.0)
redis (~> 3.2, >= 3.2.1)
redis-namespace (~> 1.5, >= 1.5.2)
sidekiq-failures (0.4.5)
sidekiq (>= 2.16.0)
sinatra (1.4.6)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
soda-ruby (0.2.13)
hashie
spreadsheet (0.9.4)
ruby-ole (>= 1.0)
spring (1.3.6)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (2.2.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
teaspoon (1.0.2)
railties (>= 3.2.5, < 5)
teaspoon-mocha (2.2.4)
teaspoon (>= 1.0.0)
thor (0.19.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
timeliness (0.3.7)
timers (4.0.1)
hitimes
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.38)
uglifier (2.2.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
validates_timeliness (3.0.14)
timeliness (~> 0.3.6)
vcr (2.9.3)
warden (1.2.3)
rack (>= 1.0)
wasabi (3.2.0)
httpi (~> 2.0)
nokogiri (>= 1.4.0, < 1.6)
wash_out (0.8.4)
nori (>= 2.0.0)
webmock (1.17.4)
addressable (>= 2.2.7)
crack (>= 0.3.2)
websocket (1.2.2)
whenever (0.8.4)
activesupport (>= 2.3.4)
chronic (>= 0.6.3)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
x86-mingw32
DEPENDENCIES
activerecord-import (= 0.4.1)
addressable
attr_encrypted
audited-activerecord (~> 3.0)
axlsx_rails (= 0.3.0)
better_errors
binding_of_caller
bumbler
bundler
byebug
capistrano
capistrano-ext
capistrano-sidekiq
capistrano-slack!
capybara
chromedriver-helper
coffee-rails (~> 3.2.1)
curb (= 0.9.7)
d3-rails
database_cleaner
devise
devise_security_extension
factory_girl_rails
faker
font-awesome-rails
gpgme
handlebars_assets
imgkit
jquery-rails
kaminari
launchy
meta_request (= 0.2.3)
mysql2 (= 0.3.17)
newrelic_rpm
nguyen
paperclip
rails (~> 3.2.14)
rails_12factor
rolify
rspec-expectations
rspec-rails
rubyXL
rvm-capistrano
sass-rails (~> 3.2.3)
savon
selenium-webdriver
shoulda-matchers
sidekiq
sidekiq-failures
sinatra
soda-ruby
spreadsheet
spring
spring-commands-rspec
teaspoon-mocha
uglifier (>= 1.0.3)
validates_timeliness
vcr
wash_out
webmock
whenever
wkhtmltoimage-binary!
RUBY VERSION
ruby 2.3.3p222
BUNDLED WITH
1.17.3
我一整天都在为此苦苦思索,阅读了我能找到的所有 Stack Overflow 和支持文章,但还没弄清楚我的配置哪里出了问题。
在撰写本文时(2020 年 10 月发布)与 activerecord 3.2 一起尝试使用最新版本的 activerecord-import gem 时,您似乎 运行 遇到了兼容性问题.22.5(2016 年 9 月发布)。你确实提到它是一个 rails 3.2.15 应用程序,但你没有使用令人困惑的 activerecord 3.2.15。
尝试使用 activerecord-import 0.4.1(2013 年 7 月发布)和 activerecord 3.2.15 应该与 rails 3.2.15.