After moving my Heroku app to Unicorn, New Relic stopped showing any reports except for deployments. I tried the solution suggested here: https://newrelic.com/docs/ruby/no-data-with-unicorn with no luck. I tried updating all gems, and now I get the error:
Exiting
/Users/bashar/.rvm/gems/ruby-1.9.3-preview1#global/gems/rpm_contrib-2.1.11/lib/rpm_contrib/instrumentation/mongoid.rb:13:in block (2 levels) in <top (required)>': uninitialized constant Mongoid::Collection (NameError)
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:53:incall'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:53:in block in execute'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:52:ineach'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:52:in execute'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:19:inblock in detect!'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:17:in each'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:17:indetect!'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/lib/new_relic/control/instrumentation.rb:93:in _install_instrumentation'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/lib/new_relic/control/instrumentation.rb:52:ininstall_instrumentation'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/lib/new_relic/control/instance_methods.rb:76:in init_plugin'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/lib/newrelic_rpm.rb:40:inblock in '
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/initializable.rb:30:in instance_exec'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/initializable.rb:30:inrun'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/initializable.rb:55:in block in run_initializers'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/initializable.rb:54:ineach'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in run_initializers'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/application.rb:136:ininitialize!'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in method_missing'
from /Users/bashar/rails-projects/myapp/config/environment.rb:5:in'
from /Users/bashar/rails-projects/myapp/config.ru:7:in block in <main>'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/builder.rb:51:ininstance_eval'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/builder.rb:51:in initialize'
from /Users/bashar/rails-projects/myapp/config.ru:1:innew'
from /Users/bashar/rails-projects/myapp/config.ru:1:in <main>'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/builder.rb:40:ineval'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/builder.rb:40:in parse_file'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/server.rb:200:inapp'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/commands/server.rb:46:in app'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/server.rb:301:inwrapped_app'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/server.rb:252:in start'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/commands/server.rb:70:instart'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/commands.rb:55:in block in <top (required)>'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/commands.rb:50:intap'
from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/commands.rb:50:in <top (required)>'
from script/rails:6:inrequire'
from script/rails:6:in `'
I have the following gems in order:
gem 'rpm_contrib'
gem 'newrelic_rpm'
gem 'newrelic_moped'
I have had similar problem in the past when I upgraded to Mongoid 3, but back then the solution was newrelic_moped. Not this time it seems.
Any idea?
I had the same. Add the code below to config/initializers/newrelic.rb:
# Ensure the agent is started using Unicorn.
# This is needed when using Unicorn and preload_app is not set to true.
# See https://newrelic.com/docs/ruby/no-data-with-unicorn
if defined? Unicorn
::NewRelic::Agent.manual_start()
::NewRelic::Agent.after_fork(:force_reconnect => true)
end
Related
Capistrano 3.7.2, Rails 5.0.2, and Ruby 2.4.0 to be specific. The error I get occurs after Execute load:defaults:
** Execute load:defaults
cap aborted!
NameError: uninitialized constant ActiveSupport::Rescuable
/Users/username/.rvm/gems/ruby-2.4.0/gems/actionmailer-5.0.2/lib/action_mailer/rescuable.rb:6:in `<module:Rescuable>'
/Users/username/.rvm/gems/ruby-2.4.0/gems/actionmailer-5.0.2/lib/action_mailer/rescuable.rb:4:in `<module:ActionMailer>'
/Users/username/.rvm/gems/ruby-2.4.0/gems/actionmailer-5.0.2/lib/action_mailer/rescuable.rb:1:in `<top (required)>'
/Users/username/.rvm/gems/ruby-2.4.0/gems/actionmailer-5.0.2/lib/action_mailer/base.rb:8:in `require'
/Users/username/.rvm/gems/ruby-2.4.0/gems/actionmailer-5.0.2/lib/action_mailer/base.rb:8:in `<top (required)>'
/Users/username/rails_5_test_app/config/deploy/notify/cap_mailer.rb:5:in `require'
/Users/username/rails_5_test_app/config/deploy/notify/cap_mailer.rb:5:in `<top (required)>'
config/deploy.rb:4:in `require'
config/deploy.rb:4:in `<top (required)>'
/Users/username/.rvm/gems/ruby-2.4.0/gems/capistrano-3.7.2/lib/capistrano/setup.rb:27:in `load'
/Users/username/.rvm/gems/ruby-2.4.0/gems/capistrano-3.7.2/lib/capistrano/setup.rb:27:in `block (3 levels) in <top (required)>'
/Users/username/.rvm/gems/ruby-2.4.0/gems/capistrano-3.7.2/lib/capistrano/configuration/variables.rb:32:in `untrusted!'
/Users/username/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/delegate.rb:83:in `method_missing'
/Users/username/.rvm/gems/ruby-2.4.0/gems/capistrano-3.7.2/lib/capistrano/setup.rb:26:in `block (2 levels) in <top (required)>'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/Users/username/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/Users/username/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
/Users/username/.rvm/gems/ruby-2.4.0/gems/capistrano-3.7.2/lib/capistrano/application.rb:14:in `run'
/Users/username/.rvm/gems/ruby-2.4.0/gems/capistrano-3.7.2/bin/cap:3:in `<top (required)>'
/Users/username/.rvm/gems/ruby-2.4.0/bin/cap:22:in `load'
/Users/username/.rvm/gems/ruby-2.4.0/bin/cap:22:in `<main>'
/Users/username/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
/Users/username/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => staging
I'm about to start upgrading my Rails 4 apps to Rails 5, and decided to do a small test app to make sure all my gems are working. Everything is fine, except for the code I've been using since Rails 2 to send emails during a Capistrano deploy, which results in this error when I try to require or load the mailer code; line 4 of deploy.rb is the require. If I comment that out and set a flag to not send an email, the deploy works perfectly.
The mailer code (based off of something posted by Mislav Marohnić years ago):
cap_mailer.rb:
require "action_mailer"
yaml_config = File.read("config/email.yml")
email_config = YAML.load(yaml_config)
ActionMailer::Base.delivery_method = email_config['delivery_method'] # currently set to :smtp
ActionMailer::Base.smtp_settings = {
address: email_config['smtp_settings']['address'],
port: email_config['smtp_settings']['port'],
notify_emails: email_config['notify_emails']
}
ActionMailer::Base.view_paths = File.dirname(__FILE__)
class CapMailer < ActionMailer::Base
default :from => 'App Deployment <app_deploy#my.org>'
def deploy_notification(cap_vars)
#now = Time.now
set :body, ENV['comment']
mail(:to => fetch(:notify_emails),
:subject => "#{fetch(:human_readable_application_name)} - Changes to application on #{fetch(:stage)} server at #{fetch(:host)}"
)
end
def test_email
#now = Time.now
mail(:to => "developer#my.org",
:subject => "#{fetch(:human_readable_application_name)} - Capistrano test email #{#now.strftime("on %m/%d/%Y at %I:%M %p")}"
)
end
end
All I can dig up online are references to very similar mailing set-ups (e.g. https://gist.github.com/johnthethird/955917) that were written for older versions of everything. There are several gems written to send mail during Capistrano deploys, but they have the same problem with being really old (capistrano-notifier, capistrano_mailer).
So at this point I'm stuck. Googling NameError: uninitialized constant ActiveSupport::Rescuable suggested maybe this is a config problem, but I don't know what to look for there. ActiveSupport::Rescuable IS there in my Rails installation; I double-checked. Any ideas would be appreciated.
Looks like you need to load ActiveSupport first, like this:
require "active_support"
require "action_mailer"
I am trying to create a Rails app in Heroku. I run it locally(nitrous.io) and works fine. I am not sure what is going on here and no idea what I did wrong. I have already read many other answers on SO but none seemed to work for me. I hope someone has experience with this and can help me out!
Following the directions here I already added this:
#config/application.rb
config.serve_static_assets = true
#Gemfile
gem 'rails_12factor', group: :production
.
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
IndexError: string not matched
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0/lib/active_record/connection_handling.rb:76:in `[]='
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0/lib/active_record/connection_handling.rb:76:in `block in config'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0/lib/active_record/connection_handling.rb:74:in `tap'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0/lib/active_record/connection_handling.rb:74:in `config'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0/lib/active_record/connection_handling.rb:69:in `resolve'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0/lib/active_record/core.rb:46:in `configurations='
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0/lib/active_record/railtie.rb:128:in `block (2 levels) in <class:Railtie>'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:27:in `each'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0/lib/active_record/railtie.rb:118:in `block in <class:Railtie>'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `instance_exec'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `run'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/railties-4.1.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/railties-4.1.0/lib/rails/initializable.rb:54:in `run_initializers'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/railties-4.1.0/lib/rails/application.rb:288:in `initialize!'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/railties-4.1.0/lib/rails/railtie.rb:194:in `public_send'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/railties-4.1.0/lib/rails/railtie.rb:194:in `method_missing'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/config/environment.rb:5:in `<top (required)>'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `block in require'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/railties-4.1.0/lib/rails/application.rb:264:in `require_environment!'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/railties-4.1.0/lib/rails/application.rb:367:in `block in run_tasks_blocks'
/tmp/build_5191aa8d-0f78-44fd-a9ad-b6620c655951/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.1.3/lib/sprockets/rails/task.rb:55: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
IndexError: string not matched
Indicates that somewhere a string is being accessed as a Hash. For example
#name = 'John'
#name['b'] => will throw this error
Take a look at your config files, it seems to halt there.
My rails project works before. I got this error because I deleted mysql and everything associated mysql.
Then I reinstalled mysql. It got this error. Then I reinstalled ruby and rails. The error is still here. Using "rails new myapp",
then "bundle instal",
then "rails s",
I got the following error:
=> Booting WEBrick
=> Rails 4.0.2 application starting in development on
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
**/home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `active_record' for #<Rails::Application::Configuration:0x0000000303cae8> (NoMethodError)
from /home/cwu/Dropbox/project/web/atop/config/environments/development.rb:23:in `block in <top (required)>'**
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:24:in `class_eval'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:24:in `configure'
from /home/cwu/Dropbox/project/web/atop/config/environments/development.rb:1:in `<top (required)>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:591:in `block (2 levels) in <class:Engine>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:590:in `each'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:590:in `block in <class:Engine>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:418:in `block (2 levels) in each_strongly_connected_component_from'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:417:in `block in each_strongly_connected_component_from'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:44:in `each'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:44:in `tsort_each_child'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:411:in `call'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:411:in `each_strongly_connected_component_from'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/cwu/Dropbox/project/web/atop/config/environment.rb:5:in `<top (required)>'
from /home/cwu/Dropbox/project/web/atop/config.ru:3:in `require'
from /home/cwu/Dropbox/project/web/atop/config.ru:3:in `block in <main>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /home/cwu/Dropbox/project/web/atop/config.ru:in `new'
from /home/cwu/Dropbox/project/web/atop/config.ru:in `<main>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands/server.rb:48:in `app'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands/server.rb:75:in `start'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:76:in `block in <top (required)>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
The error is clear that in config/environments/development.rb:23 you configure active_record which is not loaded.
Just remove
config.active_record.migration_error = :page_load
Will be ok.
Leedy Liu is right to some degree, but if you're getting this error when you create a new Rails app, t suggests a deeper problem with your environment
According to this answer, you may have require "active_record/railtie" commented out in your application.rb file. Please check to make sure this is not the case
You may have to re-install Rails with ActiveRecord to ensure the functionality is restored with your app. Have you tried this:
gem install bundler
gem install rails
bundle install
Other than that, you need to ensure Ruby on Rails is installed correctly. What env are you running? Linux or Windows?
As a general fix, remove all references to active_record. Easiest way is to do a find on the root directory of "active_records", find all usages, and remove them. I found usages in config/application.rb and config/environments/development and production.rb.
Try:
'gem install bundler'
then:
'bundle install'
again.
See if it clears up.
Comment config.active_record.raise_in_transactional_callbacks = true in config/application.rb and config.active_record.migration_error = :page_load in config/environments/development.rb.
I am trying to install RSpec to do some testing on an app that I did not write. I've placed
gem "rspec-rails", "~> 2.8"
in my gemfile and ran bundle install. This worked fine. Until I ran
rails generate rspec:install
I get this error:
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/whiny_nil.rb:48:in
method_missing': undefined methodto_sym' for nil:NilClass
(NoMethodError) from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1309:in
action_path' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1304:in
path_for_action' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1159:in
match' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1358:in
match' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:394:in
map_method' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:323:in
get' from
/Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:447:in
block (4 levels) in <top (required)>' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:565:in
block in controller' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:546:in
scope' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:565:in
controller' from
/Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:446:in
block (3 levels) in <top (required)>' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:624:in
block in namespace' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:546:in
scope' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:624:in
namespace' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1119:in
namespace' from
/Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:406:in
block (2 levels) in ' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:624:in
block in namespace' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:546:in
scope' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:624:in
namespace' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1119:in
namespace' from
/Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:405:in
block in <top (required)>' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/route_set.rb:239:in
instance_exec' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/route_set.rb:239:in
draw' from
/Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:1:in
' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:in
load' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:in
block in load' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in
block in load_dependency' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:597:in
new_constants_in' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in
load_dependency' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:in
load' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:127:in
block in reload_routes!' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:127:in
each' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:127:in
reload_routes!' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:120:in
block in routes_reloader' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/file_update_checker.rb:32:in
call' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/file_update_checker.rb:32:in
execute_if_updated' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application/finisher.rb:51:in
block (2 levels) in <module:Finisher>' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application/finisher.rb:52:in
call' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application/finisher.rb:52:in
block in <module:Finisher>' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/initializable.rb:25:in
instance_exec' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/initializable.rb:25:in
run' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/initializable.rb:50:in
block in run_initializers' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/initializable.rb:49:in
each' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/initializable.rb:49:in
run_initializers' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:134:in
initialize!' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:77:in
method_missing' from
/Users/anthonyto/ActiveNetwork/active-trainer/config/environment.rb:5:in
<top (required)>' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in
require' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in
block in require' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in
block in load_dependency' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:597:in
new_constants_in' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in
load_dependency' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in
require' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:103:in
require_environment!' from
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/commands.rb:16:in
<top (required)>' from script/rails:7:inrequire' from
script/rails:7:in `'
I am running ruby version 1.9.3 and rails version 3.0.20. I can provide any additional information, any help would be very greatly appreciated. Thank you all!
EDIT: Turns out I am getting this same error when I try to start my rails server. Seems like there is a deeper issue with my app. I certainly did not have this issue before, and cannot think of anything I did that would've caused it.
FIX: So I figured out what was going on, i'll leave it here for anyone else that runs into this annoying error. Turns out I was being an idiot and left some faulty code in the routes.rb file that looked like this:
controller :calendar do
get #write some routes here
end
Commented that out, and everything worked fine.
I am having some problems getting Sidekiq to run on my VPS. Everything works fine locally but once I deploy I get the following error in my unicorn log:
E, [2012-09-18T21:41:19.670672 #1308] ERROR -- : uninitialized constant MailchimpWorker::Sidekiq (NameError)
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing'
/home/deployer/production/releases/20120919013128/app/workers/mailchimp_worker.rb:3:in `<class:MailchimpWorker>'
/home/deployer/production/releases/20120919013128/app/workers/mailchimp_worker.rb:1:in `<top (required)>'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:438:in `each'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:438:in `block in eager_load!'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:436:in `each'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:436:in `eager_load!'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/deployer/production/releases/20120919013128/config/environment.rb:5:in `<top (required)>'
config.ru:4:in `require'
config.ru:4:in `block in <main>'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
Here is the contents of my worker file:
class MailchimpWorker
include Sidekiq::Worker
LIST_ID = '844161948b'
def perform(email)
Gibbon.listSubscribe id: LIST_ID, email_address: email
end
end
Any ideas as to what I'm doing wrong?
This looks like gem 'sidekiq' is missing from your Gemfile.
If it works on dev but not production, it sounds like bundler isn't loading the gem in the production environment. Which depends on what group the gem is listed in your Gemfile and also how you deploy (how do you have bundler install your gems on production?).
So, can you post your Gemfile, and also the relevant bits in your deployment scripts?
Also double check that the sidekiq procs are being started using bundle exec.
are you running unicorn inside of bundler?
bundle exec unicorn