Rails 4 - 生产资产:ActiveRecord中的预编译结果:: NoDatabaseError:FATAL:数据库不存在

时间:2015-01-20 08:19:07

标签: ruby-on-rails-4 activeadmin precompile

似乎无法弄清楚为什么在推送到Heroku之前我不能再预编译资产。详情如下。目前正在运行Rails 4.1.6。其他一些可能相关的信息:

Bundler版本1.7.12。
gem'activeadmin',github:'activeadmin'
宝石'formtastic','3.1.2'

当config.assets.initialize_on_precompile = false修复它时,我所能找到的只是pre-Rails 4的引用,不再适用。

为什么它试图连接到数据库的任何想法?

> RAILS_ENV=production bundle exec rake assets:precompile

rake aborted!
ActiveRecord::NoDatabaseError: FATAL:  database "xyz" does not exist
Run `$ bin/rake db:create db:migrate` to create your database
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:898:in `rescue in connect'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `connect'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:568:in `initialize'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:435:in `new_connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:445:in `checkout_new_connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `acquire_connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:351:in `block in checkout'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:350:in `checkout'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in `retrieve_connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_handling.rb:87:in `connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/model_schema.rb:214:in `columns'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/model_schema.rb:223:in `columns_hash'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/relation/delegation.rb:48:in `columns_hash'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/relation/calculations.rb:170:in `block in pluck'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/relation/calculations.rb:169:in `map'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/relation/calculations.rb:169:in `pluck'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/querying.rb:14:in `pluck'
/Users/abc/workspace/xyz/app/admin/product.rb:31:in `block in <top (required)>'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/dsl.rb:15:in `instance_exec'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/dsl.rb:15:in `run_registration_block'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/namespace.rb:223:in `parse_registration_block'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/namespace.rb:48:in `register'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/application.rb:136:in `register'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin.rb:75:in `register'
/Users/abc/workspace/xyz/app/admin/product.rb:1:in `<top (required)>'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `load'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `block in load'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `load'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/application.rb:194:in `block in load'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/error.rb:40:in `capture'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/application.rb:194:in `load'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/application.rb:186:in `block in load!'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/application.rb:186:in `each'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/application.rb:186:in `load!'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/application.rb:208:in `routes'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin.rb:79:in `routes'
/Users/abc/workspace/xyz/config/routes.rb:3:in `block in <top (required)>'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.6/lib/action_dispatch/routing/route_set.rb:337:in `instance_exec'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.6/lib/action_dispatch/routing/route_set.rb:337:in `eval_block'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.6/lib/action_dispatch/routing/route_set.rb:315:in `draw'
/Users/abc/workspace/xyz/config/routes.rb:1:in `<top (required)>'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `load'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `block in load'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `load'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/routes_reloader.rb:40:in `each'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/routes_reloader.rb:40:in `load_paths'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/routes_reloader.rb:16:in `reload!'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/routes_reloader.rb:26:in `block in updater'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/file_update_checker.rb:75:in `call'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/file_update_checker.rb:75:in `execute'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/routes_reloader.rb:27:in `updater'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/finisher.rb:71:in `block in <module:Finisher>'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `instance_exec'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `run'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/initializable.rb:54:in `run_initializers'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application.rb:300:in `initialize!'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/railtie.rb:194:in `public_send'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/railtie.rb:194:in `method_missing'
/Users/abc/workspace/xyz/config/environment.rb:5:in `<top (required)>'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `block in require'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application.rb:276:in `require_environment!'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application.rb:389:in `block in run_tasks_blocks'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/sprockets-rails-2.2.2/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
/Users/abc/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
/Users/abc/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
PG::Error: FATAL:  database "xyz" does not exist
Run `$ bin/rake db:create db:migrate` to create your database
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `initialize'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `new'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `connect'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:568:in `initialize'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:435:in `new_connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:445:in `checkout_new_connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `acquire_connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:351:in `block in checkout'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:350:in `checkout'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in `retrieve_connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/connection_handling.rb:87:in `connection'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/model_schema.rb:214:in `columns'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/model_schema.rb:223:in `columns_hash'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/relation/delegation.rb:48:in `columns_hash'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/relation/calculations.rb:170:in `block in pluck'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/relation/calculations.rb:169:in `map'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/relation/calculations.rb:169:in `pluck'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.6/lib/active_record/querying.rb:14:in `pluck'
/Users/abc/workspace/xyz/app/admin/product.rb:31:in `block in <top (required)>'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/dsl.rb:15:in `instance_exec'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/dsl.rb:15:in `run_registration_block'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/namespace.rb:223:in `parse_registration_block'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/namespace.rb:48:in `register'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/application.rb:136:in `register'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin.rb:75:in `register'
/Users/abc/workspace/xyz/app/admin/product.rb:1:in `<top (required)>'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `load'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `block in load'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `load'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/application.rb:194:in `block in load'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/error.rb:40:in `capture'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/application.rb:194:in `load'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/application.rb:186:in `block in load!'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/application.rb:186:in `each'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/application.rb:186:in `load!'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin/application.rb:208:in `routes'
/Users/abc/.rvm/gems/ruby-2.1.2/bundler/gems/activeadmin-f51d96dddb5e/lib/active_admin.rb:79:in `routes'
/Users/abc/workspace/xyz/config/routes.rb:3:in `block in <top (required)>'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.6/lib/action_dispatch/routing/route_set.rb:337:in `instance_exec'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.6/lib/action_dispatch/routing/route_set.rb:337:in `eval_block'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.6/lib/action_dispatch/routing/route_set.rb:315:in `draw'
/Users/abc/workspace/xyz/config/routes.rb:1:in `<top (required)>'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `load'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `block in load'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `load'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/routes_reloader.rb:40:in `each'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/routes_reloader.rb:40:in `load_paths'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/routes_reloader.rb:16:in `reload!'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/routes_reloader.rb:26:in `block in updater'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/file_update_checker.rb:75:in `call'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/file_update_checker.rb:75:in `execute'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/routes_reloader.rb:27:in `updater'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application/finisher.rb:71:in `block in <module:Finisher>'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `instance_exec'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `run'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/initializable.rb:54:in `run_initializers'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application.rb:300:in `initialize!'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/railtie.rb:194:in `public_send'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/railtie.rb:194:in `method_missing'
/Users/abc/workspace/xyz/config/environment.rb:5:in `<top (required)>'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `block in require'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application.rb:276:in `require_environment!'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/application.rb:389:in `block in run_tasks_blocks'
/Users/abc/.rvm/gems/ruby-2.1.2/gems/sprockets-rails-2.2.2/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
/Users/abc/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
/Users/abc/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace)

1 个答案:

答案 0 :(得分:0)

看起来我太专注于错误的最后几行,并尝试在引用类似文本的页面上阅读的所有内容(以及多个Heroku环境之间的不同结果让我更多)并跳过相关产品.rb这些线条会让我指出这个问题。我在设置特定页面的范围和过滤器时有数据库参考,没有意识到那些会影响资产的生成。

Product.pluck(:type).uniq.sort.each do |p|
  scope(p) { |scope| scope.where(type: p) }
end

filter :type, as: :select, collection: Product.pluck(:type).uniq.sort

在对这些行进行注释后,预编译再次正常工作。

=====

一旦我知道要搜索什么,就找到了这个:https://github.com/activeadmin/activeadmin/issues/2781

更好的解决方案是将其添加到routes.rb:

ActiveAdmin.routes(self) unless ARGV.grep(/assets:(precompile|clean)/).any?