I'm trying to call Rails.application.eager_load! in my rake task.
This is the error that I'm getting.
LoadError: No such file to load -- application_controller
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:457:in `load'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:457:in `block in load_file'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:647:in `new_constants_in'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:456:in `load_file'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:354:in `require_or_load'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:317:in `depend_on'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:233:in `require_dependency'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.1/lib/rails/engine.rb:473:in `block (2 levels) in eager_load!'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.1/lib/rails/engine.rb:472:in `each'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.1/lib/rails/engine.rb:472:in `block in eager_load!'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.1/lib/rails/engine.rb:470:in `each'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.1/lib/rails/engine.rb:470:in `eager_load!'
/home/jkoehms/TECC/tecc/lib/tasks/populate.rake:3:in `<top (required)>'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `block in load'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.1/lib/rails/engine.rb:659:in `block in run_tasks_blocks'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.1/lib/rails/engine.rb:659:in `each'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.1/lib/rails/engine.rb:659:in `run_tasks_blocks'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.1/lib/rails/application.rb:452:in `run_tasks_blocks'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.1/lib/rails/engine.rb:453:in `load_tasks'
/home/jkoehms/TECC/tecc/Rakefile:6:in `<top (required)>'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/bin/ruby_executable_hooks:15:in `eval'
/home/jkoehms/.rvm/gems/ruby-2.0.0-p643/bin/ruby_executable_hooks:15:in `<main>
Looking into this further, I found that the autoload_paths was empty in my active_support/dependencies.rb file. This should have been taken care of by the :set_autoload_paths initializer in engine.rb. However the initializer is never called. When I byebug into eager_load and manually call it myself the error goes away. Why isn't the initializer being called?
UPDATE:
when I call Rails.initialize! it then works. But this seems like a hefty call. Can someone explain what's happening?
I think you can find the answer about the reasons here: Rails 3 rake task can't find model in production
I have a similar problem before:
app#LacosteDev-aws:~/app/current$ rake resque:preload QUEUE=* --trace
** Invoke resque:preload (first_time)
** Invoke resque:setup (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute resque:setup
** Execute resque:preload
rake aborted!
NameError: uninitialized constant ResourcesController
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/bundler/gems/qor-c93ebb95226f/widget/app/controllers/resources/widget_controller.rb:2:in `const_missing'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/bundler/gems/qor-c93ebb95226f/widget/app/controllers/resources/widget_controller.rb:2
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:225:in `load_dependency'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:348:in `require_or_load'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:302:in `depend_on'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:214:in `require_dependency'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/railties-3.1.3/lib/rails/engine.rb:417:in `eager_load!'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/railties-3.1.3/lib/rails/engine.rb:416:in `each'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/railties-3.1.3/lib/rails/engine.rb:416:in `eager_load!'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/railties-3.1.3/lib/rails/engine.rb:414:in `each'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/railties-3.1.3/lib/rails/engine.rb:414:in `eager_load!'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `to_proc'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `each'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `all'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/railties-3.1.3/lib/rails/engine.rb:412:in `eager_load!'
/media/ebsdisk/app/releases/20150630071432/vendor/bundle/ruby/1.8/gems/resque-1.25.2/lib/resque/tasks.rb:61
I just add config.dependency_loading = true if $rails_rake_task to config/environments/production.rb it works for me.
You can also set $rails_rake_task = true in your Rakefile manually.
Related
When I execute rake db:create command it will display some error's
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
NoMethodError: undefined method `configure' for AjaxDatatablesRails:Module
/home/jsmani/project-folder/config/initializers/ajax_datatables_rails.rb:3:in `<top (required)>'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:285:in `block in load'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:257:in `load_dependency'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:285:in `load'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/engine.rb:663:in `block in load_config_initializer'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.6/lib/active_support/notifications.rb:170:in `instrument'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/engine.rb:662:in `load_config_initializer'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/engine.rb:619:in `each'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/engine.rb:619:in `block in <class:Engine>'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/initializable.rb:32:in `instance_exec'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/initializable.rb:32:in `run'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/initializable.rb:61:in `block in run_initializers'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/initializable.rb:50:in `each'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/initializable.rb:50:in `tsort_each_child'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/initializable.rb:60:in `run_initializers'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/application.rb:361:in `initialize!'
/home/jsmani/project-folder/config/environment.rb:6:in `<top (required)>'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/skylight-5.1.0/lib/skylight/probes.rb:167:in `require'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:291:in `block in require'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:257:in `load_dependency'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:291:in `require'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/application.rb:337:in `require_environment!'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/application.rb:520:in `block in run_tasks_blocks'
/home/jsmani/.rvm/gems/ruby-2.5.3/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/home/jsmani/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
/home/jsmani/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => db:create => db:load_config => environment
(See full trace by running task with --trace)
In gemfile give some specific version for AjaxDataTablesRails like (gem 'ajax-datatables-rails', '~> 1.0.0') instead of giving (gem 'ajax-datatables-rails') like this.
After save this changes let execute this command (bundle install) on your terminal .
And now you execute rake db:create command .
and do following command rake db:migrate then start your server rails s
I created a migration. I am trying to run it by:
rake db:migrate:up VERSION=
It raises the following error:
D, [2018-06-03T13:20:41.295098 #2257] DEBUG -- : ** [Raven] Sending event 2a32cb0c249acd2efde26ce6453a2d77 to Sentry
D, [2018-06-03T13:20:41.343397 #2257] DEBUG -- : ** [Raven] Raven HTTP Transport connecting to https://app.getsentry.com
rake aborted!
NoMethodError: undefined method `last_comment' for #<Rake::Application:0x007fb71d8a76a0>
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/rake_task.rb:101:in `define'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/rake_task.rb:78:in `initialize'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rspec-rails-3.0.2/lib/rspec/rails/tasks/rspec.rake:11:in `new'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rspec-rails-3.0.2/lib/rspec/rails/tasks/rspec.rake:11:in `<top (required)>'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rspec-rails-3.0.2/lib/rspec-rails.rb:13:in `block in <class:Railtie>'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/railtie.rb:237:in `instance_exec'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/railtie.rb:237:in `block in run_tasks_blocks'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/railtie.rb:245:in `each'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/railtie.rb:245:in `each_registered_block'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/railtie.rb:237:in `run_tasks_blocks'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/application.rb:437:in `block in run_tasks_blocks'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/engine/railties.rb:13:in `each'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/engine/railties.rb:13:in `each'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/application.rb:437:in `run_tasks_blocks'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/engine.rb:453:in `load_tasks'
/Rakefile:6:in `<top (required)>'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/rake_module.rb:29:in `load'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/rake_module.rb:29:in `load_rakefile'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/application.rb:703:in `raw_load_rakefile'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/application.rb:104:in `block in load_rakefile'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/application.rb:103:in `load_rakefile'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/application.rb:82:in `block in run'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/application.rb:80:in `run'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/.rbenv/versions/2.1.2/bin/rake:23:in `load'
/.rbenv/versions/2.1.2/bin/rake:23:in `<main>'
How can I deal with it?
Specify version when migrating. This is good is you want to migrate only specific version of your migration. If you want to migrate all pending migration you can just say rake db:migrate.
Example:
rake db:migrate:up VERSION=20120820165642
I had to run the command against local rails
rake db:migrate:up VERSION=20120820165642 RAILS_ENV=test
works for me
I'm trying to push my changes to Heroku with the following command: git push heroku master
When running the rake assets:precompile, I get the following error(s):
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
NameError: undefined local variable or method `fkalkhalidi' for #<Pinteresting::Application:0x007f48fd2d6fc0>
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/config/environments/production.rb:80:in `block in <top (required)>'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/railtie.rb:210:in `instance_eval'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/railtie.rb:210:in `configure'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/config/environments/production.rb:1:in `<top (required)>'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/engine.rb:594:in `block (2 levels) in <class:Engine>'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/engine.rb:593:in `each'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/engine.rb:593:in `block in <class:Engine>'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:30:in `instance_exec'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:30:in `run'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:55:in `block in run_initializers'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:44:in `each'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:44:in `tsort_each_child'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:54:in `run_initializers'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/application.rb:300:in `initialize!'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/config/environment.rb:5:in `<top (required)>'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/application.rb:276:in `require_environment!'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/application.rb:389:in `block in run_tasks_blocks'
/tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.2.0/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
Tasks: TOP => environment
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app
Appreciate any help. First time learning RoR.
What's inside the file config/environments/production.rb at line 80?
Search your code, specifically in the production.rb file. It's likely there is a fkalkhalidi string somewhere that is causing the error.
I'm trying to run a heroku console command from a rake task, so my approach is to try to do it all on one line.
Note that this works
heroku run console
Rails.cache.clear
Here is my rake task:
task :setup_staging_env do
sh "heroku run console Rails.cache.clear"
end
But this fails. So to simplify I tried just that command on the command line and get this:
heroku run console Rails.cache.clear
Running console Rails.cache.clear attached to terminal... up, run.1
You did not specify how you would like Rails to report deprecation notices for your Rails.cache.clear environment, please set config.active_support.deprecation to :log, :notify or :stderr at config/environments/Rails.cache.clear.rb
/usr/local/lib/ruby/1.9.1/uri/common.rb:156:in `split': bad URI(is not URI?): (URI::InvalidURIError)
from /usr/local/lib/ruby/1.9.1/uri/common.rb:174:in `parse'
from /usr/local/lib/ruby/1.9.1/uri/common.rb:628:in `parse'
from /app/config/initializers/resque.rb:2:in `<top (required)>'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `block in load'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:556:in `block (2 levels) in <class:Engine>'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:555:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:555:in `block in <class:Engine>'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /app/config/environment.rb:6:in `<top (required)>'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:83:in `require_environment!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
So how can I run this command from a rake task?
I'm attempting to update my existing rails app (3.0.3) to 3.1.0.beta1. I've install the rails gem and ran the bundle command to pull in all of the updated gems. When I run rake rails:update though I get:
rake aborted!
undefined method `join_asset_file_contents' for module `ActionView::Helpers::AssetTagHelper'
What am I doing wrong?
Trace Output
rake aborted!
undefined method `join_asset_file_contents' for module `ActionView::Helpers::AssetTagHelper'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.beta1/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.beta1/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method_chain'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/smurf-1.0.6/lib/smurf.rb:15:in `<module:AssetTagHelper>'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/smurf-1.0.6/lib/smurf.rb:5:in `<top (required)>'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `require'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `each'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `block in require'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `each'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `require'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler.rb:120:in `require'
/Users/Kyle/Desktop/skateparks-web/config/application.rb:7:in `<top (required)>'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/Kyle/Desktop/skateparks-web/Rakefile:1:in `<top (required)>'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2017:in `block in load_rakefile'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2000:in `block in run'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'
After removing the Smurf Gem
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <top (required)> at /Users/Kyle/Desktop/skateparks-web/config/application.rb:7)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <top (required)> at /Users/Kyle/Desktop/skateparks-web/config/application.rb:7)
** Invoke rails:update (first_time)
** Invoke rails:update:configs (first_time)
** Execute rails:update:configs
conflict config/boot.rb
Overwrite /Users/Kyle/Desktop/skateparks-web/config/boot.rb? (enter "h" for help) [Ynaqdh] y
force config/boot.rb
exist config
conflict config/routes.rb
Overwrite /Users/Kyle/Desktop/skateparks-web/config/routes.rb? (enter "h" for help) [Ynaqdh] n
skip config/routes.rb
conflict config/application.rb
Overwrite /Users/Kyle/Desktop/skateparks-web/config/application.rb? (enter "h" for help) [Ynaqdh] y
force config/application.rb
identical config/environment.rb
** Invoke rails:update:javascripts (first_time)
** Execute rails:update:javascripts
rake aborted!
undefined method `create_javascript_files' for #<Rails::Generators::AppGenerator:0x00000100fbb160>
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.beta1/lib/rails/tasks/framework.rake:40:in `invoke_from_app_generator'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.beta1/lib/rails/tasks/framework.rake:63:in `block (3 levels) in <top (required)>'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:607:in `block in invoke_prerequisites'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:596:in `block in invoke_with_call_chain'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'
join_asset_file_contents method is moved from
actionpack/lib/action_view/helpers/asset_tag_helper.rb
to
actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb
That is the reason why you see this error.
Can you please run the rake command with --trace to see why join_asset_file_contents is being executed in the call graph?