Build Warnings after Upgrade Heroku 18 to 22 - ruby-on-rails

How do I manage the scout-APM warnings, getting during deployment on the Heroku staging server after upgrading Heroku versions(18-22) with config "ruby(3.1.2) and rails(6.0.3.3)"?
remote: I, [2022-09-07T13:32:05.994002 #19] INFO -- : Raven 3.1.2 ready to catch errors
remote: [Scout] [09/07/22 13:32:06 +0000 release.7924 (19)] WARN : Exception loading instruments:
remote: [Scout] [09/07/22 13:32:06 +0000 release.7924 (19)] WARN : undefined method `call' for class `Redis::Client'
remote:
remote: alias_method :call_without_scout_instruments, :call
remote: ^^^^^^^^^^^^
remote: Did you mean? caller
remote: [Scout] [09/07/22 13:32:06 +0000 release.7924 (19)] WARN : [
"/app/vendor/bundle/ruby/3.1.0/gems/scout_apm-5.3.1/lib/scout_apm/instruments/redis.rb:40:in `alias_method'",
"/app/vendor/bundle/ruby/3.1.0/gems/scout_apm-5.3.1/lib/scout_apm/instruments/redis.rb:40:in `block in install'",
"/app/vendor/bundle/ruby/3.1.0/gems/scout_apm-5.3.1/lib/scout_apm/instruments/redis.rb:29:in `class_eval'",
"/app/vendor/bundle/ruby/3.1.0/gems/scout_apm-5.3.1/lib/scout_apm/instruments/redis.rb:29:in `install'",
"/app/vendor/bundle/ruby/3.1.0/gems/scout_apm-5.3.1/lib/scout_apm/instrument_manager.rb:82:in `install_instrument'",
"/app/vendor/bundle/ruby/3.1.0/gems/scout_apm-5.3.1/lib/scout_apm/instrument_manager.rb:37:in `install!'",
"/app/vendor/bundle/ruby/3.1.0/gems/scout_apm-5.3.1/lib/scout_apm/agent.rb:41:in `install'",
"/app/vendor/bundle/ruby/3.1.0/gems/scout_apm-5.3.1/lib/scout_apm.rb:223:in `block in <class:Railtie>'",
"/app/vendor/bundle/ruby/3.1.0/gems/railties-6.0.3.6/lib/rails/initializable.rb:32:in `instance_exec'",
"/app/vendor/bundle/ruby/3.1.0/gems/railties-6.0.3.6/lib/rails/initializable.rb:32:in `run'",
"/app/vendor/bundle/ruby/3.1.0/gems/railties-6.0.3.6/lib/rails/initializable.rb:61:in `block in run_initializers'",
"/app/vendor/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'",
"/app/vendor/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'",
"/app/vendor/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'",
"/app/vendor/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'",
"/app/vendor/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `each'",
"/app/vendor/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `call'",
"/app/vendor/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'",
"/app/vendor/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'",
"/app/vendor/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'",
"/app/vendor/bundle/ruby/3.1.0/gems/railties-6.0.3.6/lib/rails/initializable.rb:60:in `run_initializers'",
"/app/vendor/bundle/ruby/3.1.0/gems/railties-6.0.3.6/lib/rails/application.rb:363:in `initialize!'",
"/app/config/environment.rb:5:in `<main>'",
"/app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'",
"/app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'",
"/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require'",
"/app/vendor/bundle/ruby/3.1.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `block in require'",
"/app/vendor/bundle/ruby/3.1.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:291:in `load_dependency'",
"/app/vendor/bundle/ruby/3.1.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `require'",
"/app/vendor/bundle/ruby/3.1.0/gems/railties-6.0.3.6/lib/rails/application.rb:339:in `require_environment!'",
"/app/vendor/bundle/ruby/3.1.0/gems/railties-6.0.3.6/lib/rails/application.rb:523:in `block in run_tasks_blocks'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:243:in `block in invoke_prerequisites'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:241:in `each'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:241:in `invoke_prerequisites'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:218:in `block in invoke_with_call_chain'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:243:in `block in invoke_prerequisites'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:241:in `each'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:241:in `invoke_prerequisites'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:218:in `block in invoke_with_call_chain'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'",
"/app/vendor/bundle/ruby/3.1.0/gems/railties-6.0.3.6/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'",
"/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'",
"/app/vendor/bundle/ruby/3.1.0/gems/railties-6.0.3.6/lib/rails/commands/rake/rake_command.rb:20:in `perform'",
"/app/vendor/bundle/ruby/3.1.0/gems/railties-6.0.3.6/lib/rails/command.rb:48:in `invoke'",
"/app/vendor/bundle/ruby/3.1.0/gems/railties-6.0.3.6/lib/rails/commands.rb:18:in `<main>'",
"/app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'",
"/app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'",
"/app/bin/rails:4:in `<main>'"]

Related

How to include coalesce() in ActiveRecord statement

I want to turn this raw sql statement into an ActiveRecord statement:
def self.get_new_entry_code(table_id)
sql = "SELECT coalesce(max(code_id) + 1, 1) FROM configentries WHERE configtable_id = " + table_id.to_s
connection.execute(sql)
end
I'm struggling with the coalesce(). I tried the following:
def self.get_new_entry_code(table_id)
result = Configentry.select("coalesce(max(code_id) + 1, 1").where("configtable_id = " + table_id.to_s).first
result.id
end
But this is not working and too "raw" as well. How can I accomplish this?
What I noticed now is, it's only giving an error when I put puts result. How can this be?
Error:
E, [2017-05-10T12:30:04.604953 #93397] ERROR -- : PG::SyntaxError: ERROR: syntax error at or near "FROM"
LINE 1: ...e(max(code_id) + 1, 1) WHERE configtable_id = 106 FROM "conf...
^
: SELECT coalesce(max(code_id) + 1, 1) WHERE configtable_id = 106 FROM "configentries" ORDER BY "configentries"."id" ASC LIMIT 1
2017-05-10 12:30:04 - ActiveRecord::StatementInvalid - PG::SyntaxError: ERROR: syntax error at or near "FROM"
LINE 1: ...e(max(code_id) + 1, 1) WHERE configtable_id = 106 FROM "conf...
^
: SELECT coalesce(max(code_id) + 1, 1) WHERE configtable_id = 106 FROM "configentries" ORDER BY "configentries"."id" ASC LIMIT 1:
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `async_exec'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `block in exec_no_cache'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract_adapter.rb:378:in `block in log'
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.16/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract_adapter.rb:372:in `log'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `exec_no_cache'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/postgresql_adapter.rb:954:in `select'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract/database_statements.rb:24:in `select_all'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/querying.rb:39:in `find_by_sql'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/relation.rb:611:in `exec_queries'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/relation.rb:493:in `load'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/relation.rb:238:in `to_a'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/relation/finder_methods.rb:474:in `find_nth_with_limit'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/relation/finder_methods.rb:468:in `find_nth'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/relation/finder_methods.rb:132:in `first'
/Users/ndinatale/leanlogic-qa-prototype/server/models/device_configentry.rb:92:in `get_new_entry_code'
/Users/ndinatale/leanlogic-qa-prototype/server/lib/models_base.rb:82:in `merge_data'
/Users/ndinatale/leanlogic-qa-prototype/server/routes/02_rest_misc.rb:298:in `block (2 levels) in <top (required)>'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/transactions.rb:208:in `transaction'
/Users/ndinatale/leanlogic-qa-prototype/server/routes/02_rest_misc.rb:297:in `block in <top (required)>'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1611:in `call'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1611:in `block in compile!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in `[]'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in `block (3 levels) in route!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:994:in `route_eval'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in `block (2 levels) in route!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1015:in `block in process_route'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1013:in `catch'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1013:in `process_route'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:973:in `block in route!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:972:in `each'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:972:in `route!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1085:in `block in dispatch!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `block in invoke'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `catch'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `invoke'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1082:in `dispatch!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:907:in `block in call!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `block in invoke'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `catch'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `invoke'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:907:in `call!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:895:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.5/lib/rack/session/abstract/id.rb:225:in `context'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.5/lib/rack/session/abstract/id.rb:220:in `call'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.5/lib/rack/nulllogger.rb:9:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.5/lib/rack/head.rb:13:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.5/lib/rack/methodoverride.rb:22:in `call'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/show_exceptions.rb:25:in `call'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:182:in `call'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:2013:in `call'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1487:in `block in call'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1785:in `synchronize'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1785:in `synchronize'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1487:in `call'
/Library/Ruby/Gems/2.0.0/gems/puma-3.8.2/lib/puma/configuration.rb:224:in `call'
/Library/Ruby/Gems/2.0.0/gems/puma-3.8.2/lib/puma/server.rb:600:in `handle_request'
/Library/Ruby/Gems/2.0.0/gems/puma-3.8.2/lib/puma/server.rb:435:in `process_client'
/Library/Ruby/Gems/2.0.0/gems/puma-3.8.2/lib/puma/server.rb:299:in `block in run'
/Library/Ruby/Gems/2.0.0/gems/puma-3.8.2/lib/puma/thread_pool.rb:120:in `call'
/Library/Ruby/Gems/2.0.0/gems/puma-3.8.2/lib/puma/thread_pool.rb:120:in `block in spawn_thread'
You have syntax error
You have missed one closing bracket after coalesce(max(code_id) + 1, 1)
Configentry.select("coalesce(max(code_id) + 1, 1)").find_by(configtable_id: table_id)
Also, Prefer find_by over where().first

Circular dependency when Starting Sidekiq Queue

I get the following error when loading a sidekiq queue:
RuntimeError: Circular dependency detected while autoloading constant FileProcessor
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:492:in `load_missing_constant'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:184:in `const_missing'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:526:in `load_missing_constant'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:184:in `const_missing'
/Users/johnmcauley/workspace/wripl-capture/lib/wripl_article.rb:23:in `build_from_crawled_page'
/Users/johnmcauley/workspace/wripl-capture/app/workers/article_worker.rb:7:in `perform'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/processor.rb:75:in `execute_job'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/processor.rb:52:in `block (2 levels) in process'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:127:in `block in invoke'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/middleware/server/retry_jobs.rb:74:in `call'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-failures-0.4.4/lib/sidekiq/failures/middleware.rb:9:in `call'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/middleware/server/logging.rb:15:in `block in call'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/logging.rb:30:in `with_context'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/middleware/server/logging.rb:11:in `call'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:132:in `call'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:132:in `invoke'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/processor.rb:51:in `block in process'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/processor.rb:98:in `stats'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/sidekiq-3.4.1/lib/sidekiq/processor.rb:50:in `process'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `public_send'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `dispatch'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/celluloid-0.16.0/lib/celluloid/calls.rb:122:in `dispatch'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/celluloid-0.16.0/lib/celluloid/cell.rb:60:in `block in invoke'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/celluloid-0.16.0/lib/celluloid/cell.rb:71:in `block in task'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/celluloid-0.16.0/lib/celluloid/actor.rb:357:in `block in task'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:57:in `block in initialize'
/Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15:in `block in create'
FileProcessor is a constant in lib.
I load lib and workers using:
config.autoload_paths += %W(
#{config.root}/app/workers
#{config.root}/lib
)
The File processor class is:
class FileProcessor
def self.update_totals(source_id, update_type)
total = Total.first
if total == nil
total = Total.new
end
source = Source.find(source_id)
if update_type.to_s == "ARTICLE"
source.number_of_articles = source.number_of_articles + 1
total.number_of_articles = total.number_of_articles + 1
elsif update_type.to_s == "PAGE"
source.number_of_pages = source.number_of_pages + 1
total.number_of_pages = total.number_of_pages + 1
elsif update_type.to_s == "RSS"
source.number_of_rss_articles = source.number_of_rss_articles + 1
total.number_of_rss_articles = total.number_of_rss_articles + 1
end
source.save
total.save
end
end
I have looked around but cannot find a solution to this problem.
Any suggestions?
Ok, so this was an authoload/eagerload issue. I found some discussion on GH dealing with the issue. I still have to test in production but adding:
config.autoload_paths += %W(
#{config.root}/app/workers
#{config.root}/lib
)
config.eager_load_paths += %W(
#{config.root}/app/workers
#{config.root}/lib
)
to application.rb fixed the problem.
Thanks to:
https://github.com/mperham/sidekiq/issues/2060
https://github.com/mperham/sidekiq/issues/1927
http://blog.arkency.com/2014/11/dont-forget-about-eager-load-when-extending-autoload/

undefined method `name' for nil:NilClass in FileController#destroy

I am getting an error with this code, but I can not figure out how the name method is being called.
file_controller.rb:
91| def destroy
92| r = Module::Model.find(params[:id])
93| r.parts.each{|p| p.destroy }
94| r.destroy
95| render :nothing => true, :status => 200
96| end
The error is being thrown on the "r.destroy" line.
Here is the error:
!! There was an error ( > _ < )
!!
!! Params: {"action"=>"destroy", "controller"=>"module/controller", "id"=>"7156"}
!!
!! ERROR !!
!! NoMethodError
!!
!! /path/to/file_controller.rb:94:in `destroy'
!! undefined method `name' for nil:NilClass
!!
Additionally Requested:
class Scheduling::TimeOffRequest < Scheduling::Connection
include Logged
self.table_name = 'time_off_requests'
has_many :parts, dependent: :destroy
belongs_to :employee
belongs_to :type, foreign_key: 'request_type_id'
belongs_to :state, foreign_key: 'request_state_id'
#****************************************************************************
module STATE
PEND = 1
DENY = 2
APPROVE = 3
APPROVE_MOD = 4
end
#****************************************************************************
def self.display
mysql.query
end
end
Stack Trace:
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/associations/has_many_association.rb:80:in `cached_counter_attribute_name'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/associations/has_many_association.rb:103:in `inverse_updates_counter_cache?'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/associations/has_many_association.rb:113:in `delete_records'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/associations/collection_association.rb:493:in `remove_records'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/associations/collection_association.rb:486:in `block in delete_or_destroy'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/associations/collection_association.rb:152:in `block in transaction'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:200:in `transaction'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:253:in `block in transaction'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:226:in `block (2 levels) in run_queries_on_shard'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:476:in `using_shard'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:225:in `block in run_queries_on_shard'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:462:in `keeping_connection_proxy'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:224:in `run_queries_on_shard'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:252:in `transaction'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/transactions.rb:209:in `transaction'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/associations/collection_association.rb:151:in `transaction'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/associations/collection_association.rb:486:in `delete_or_destroy'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/associations/collection_association.rb:247:in `destroy'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/associations/collection_association.rb:170:in `destroy_all'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/associations/has_many_association.rb:26:in `handle_dependency'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/associations/builder/association.rb:97:in `has_many_dependent_for_parts'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:387:in `_run__2188473118504979458__destroy__callbacks'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:80:in `run_callbacks'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/callbacks.rb:289:in `destroy'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/transactions.rb:265:in `block in destroy'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/transactions.rb:326:in `block in with_transaction_returning_status'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `block in transaction'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:210:in `within_new_transaction'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `transaction'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:253:in `block in transaction'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:226:in `block (2 levels) in run_queries_on_shard'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:476:in `using_shard'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:225:in `block in run_queries_on_shard'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:462:in `keeping_connection_proxy'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:224:in `run_queries_on_shard'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:252:in `transaction'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/transactions.rb:209:in `transaction'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/transactions.rb:323:in `with_transaction_returning_status'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/transactions.rb:265:in `destroy'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/persistence.rb:25:in `block in destroy'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:226:in `block (2 levels) in run_queries_on_shard'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:476:in `using_shard'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:225:in `block in run_queries_on_shard'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:462:in `keeping_connection_proxy'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/proxy.rb:224:in `run_queries_on_shard'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/shard_tracking.rb:30:in `run_on_shard'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/ar-octopus-0.8.5/lib/octopus/persistence.rb:25:in `destroy'
!! /var/www/projects/releases/1435700629/app/controllers/scheduling/pto_controller.rb:94:in `destroy'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/abstract_controller/base.rb:189:in `process_action'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_controller/metal/rendering.rb:10:in `process_action'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:423:in `_run__1437761400294135477__process_action__callbacks'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:80:in `run_callbacks'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/abstract_controller/callbacks.rb:17:in `process_action'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_controller/metal/rescue.rb:29:in `process_action'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `block in instrument'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `instrument'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/abstract_controller/base.rb:136:in `process'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/abstract_controller/rendering.rb:44:in `process'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_controller/metal.rb:195:in `dispatch'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_controller/metal.rb:231:in `block in action'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:80:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:48:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/journey/router.rb:71:in `block in call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/journey/router.rb:59:in `each'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/journey/router.rb:59:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:655:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/rack/browser_monitoring.rb:32:in `traced_call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/rack-1.5.5/lib/rack/deflater.rb:25:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/rack-1.5.5/lib/rack/etag.rb:23:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/rack-1.5.5/lib/rack/conditionalget.rb:35:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/rack-1.5.5/lib/rack/head.rb:11:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/flash.rb:241:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/rack-1.5.5/lib/rack/session/abstract/id.rb:225:in `context'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/rack-1.5.5/lib/rack/session/abstract/id.rb:220:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/cookies.rb:486:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/query_cache.rb:36:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:373:in `_run__607729009339104246__call__callbacks'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:80:in `run_callbacks'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/airbrake-4.3.0/lib/airbrake/rails/middleware.rb:13:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:38:in `call_app'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `block in call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `block in tagged'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:25:in `tagged'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `tagged'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/request_id.rb:21:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/rack-1.5.5/lib/rack/methodoverride.rb:21:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/rack-1.5.5/lib/rack/runtime.rb:17:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activesupport-4.0.0/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/ssl.rb:24:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/airbrake-4.3.0/lib/airbrake/user_informer.rb:16:in `_call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/airbrake-4.3.0/lib/airbrake/user_informer.rb:12:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
!! /usr/local/rvm/ge/2.2.2/gems/passenger-5.0.6/lib/phusion_passenger/rack/thread_handler_extension.rb:85:in `process_request'
!! /usr/local/rvm/ge/2.2.2/gems/passenger-5.0.6/lib/phusion_passenger/request_handler/thread_handler.rb:155:in `accept_and_process_next_request'
!! /usr/local/rvm/ge/2.2.2/gems/passenger-5.0.6/lib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
!! /usr/local/rvm/ge/2.2.2/gems/passenger-5.0.6/lib/phusion_passenger/request_handler.rb:414:in `block (3 levels) in start_threads'
!! /usr/local/rvm/ge/2.2.2/gems/passenger-5.0.6/lib/phusion_passenger/utils.rb:111:in `block in create_thread_and_abort_on_exception'
Is anyone able to answer why #destroy is calling #name?
Now I get it, its not a callback issue. This is an issue with ActiveRecord and Ruby 2.2
You can fix it by switching the ruby version from ruby-2.2.0 to ruby-2.1.3 or rails version from 4.0.0 to 4.1.2
Check this SO link
aha!
!! /var/www/projects/shared/bundle/ruby/2.2.0/gems/activerecord-4.0.0/lib/active_record/associations/has_many_association.rb:80:in `cached_counter_attribute_name'
told you it was a callback :)
counter_cache sets up a callback to update a field when an associated record changes. Presumably you've got a counter_cache or similar call in one of the associated models? Something about the way this is set up assumes that the model that's just been deleted is still there. Are you doing counter_cache anywhere? If so then add the code for it to your question please.

no implicit conversion of nil into String (sponsorship )

I am getting the above error and it says that it has to do with the "+". Please note I did not code the below page, but I was told to fix it. If someone could help that would be awesome.
MYMOH Controller
210. def sponsorships
211. dbdc_client.materialize("cv__Recurring_Gift__c")
212. ##gifts =Cv__Recurring_Gift__c.find_all_by_cv__Contact__c(current_user.convio_id)
213. #gifts = Cv__Recurring_Gift__c.query("cv__Contact__c = '" + current_user.convio_id + "' AND Child_Status__c = 'Sponsored' and cv__Recurring_Gift_Status__c='Active'")
214. #account = Contact.find_by_Id(current_user.convio_id)
215. ##old_sponsorships = Child_Sponsorship__c.query("Sponsor__c = '" + current_user.convio_id + "' AND Status__c = 'Open'")
216. #sponsorships = #gifts # + #old_sponsorships
217. unless #sponsorships.nil?
218. #if we find sponsorships
219. #children = []
220. #sponsorships.each do | spons |
221. #photo = nil
222. unless spons.Child__c.nil?
223. #child = Child__c.find_by_Id(spons.Child__c)
224. #photoTest = Picture__c.query("Child__c='" + #child.Id + "' and Primary__c=true").first
225. #photo = #photoTest.Photo__c if #photoTest
226. if #photo.nil?
227. #attachment = Attachment.find_by_ParentId(#child.Id)
228. #photo = "<img src='https://c.na12.content.force.com/servlet/servlet.FileDownload?file=" + #attachment.Id.to_s + "' />" unless #attachment.nil?
end
#set an unused variable to carry the photo url
#child.LastModifiedById = #photo
#add child to array of children
#children << #child
end
end
end
end
FULL TRACE
app/controllers/mymoh_controller.rb:213:in `+'
app/controllers/mymoh_controller.rb:213:in `sponsorships'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/abstract_controller/base.rb:167:in `process_action'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal/rendering.rb:10:in `process_action'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:425:in `_run__3687996442544047678__process_action__3216127983448203575__callbacks'
vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/abstract_controller/callbacks.rb:17:in `process_action'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal/rescue.rb:29:in `process_action'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/notifications.rb:123:in `block in instrument'
vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/notifications.rb:123:in `instrument'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.11/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:23:in `block in process_action'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:353:in `perform_action_with_newrelic_trace'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:22:in `process_action'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/abstract_controller/base.rb:121:in `process'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/abstract_controller/rendering.rb:45:in `process'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal.rb:203:in `dispatch'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal.rb:246:in `block in action'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:73:in `call'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:36:in `call'
vendor/bundle/ruby/2.1.0/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
vendor/bundle/ruby/2.1.0/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
vendor/bundle/ruby/2.1.0/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:601:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/rack/browser_monitoring.rb:23:in `traced_call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/exception_notification-4.0.0/lib/exception_notification/rack.rb:28:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/head.rb:14:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/flash.rb:242:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/cookies.rb:341:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.11/lib/active_record/query_cache.rb:64:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `_run__790379348702901205__call__4407048364405463113__callbacks'
vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/rack/logger.rb:32:in `call_app'
vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/rack/logger.rb:16:in `block in call'
vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/tagged_logging.rb:22:in `tagged'
vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/rack/logger.rb:16:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/request_id.rb:22:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/static.rb:62:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/rack-timeout-0.2.4/lib/rack/timeout.rb:108:in `call'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/engine.rb:479:in `call'
vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/application.rb:223:in `call'
vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/rack/log_tailer.rb:17:in `call'
vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/connection.rb:53:in `process'
vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/connection.rb:39:in `receive_data'
vendor/bundle/ruby/2.1.0/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in `run_machine'
vendor/bundle/ruby/2.1.0/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in `run'
vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/backends/base.rb:73:in `start'
vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/server.rb:162:in `start'
vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/handler/thin.rb:13:in `run'
vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/server.rb:268:in `start'
vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/commands/server.rb:70:in `start'
vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/commands.rb:55:in `block in <top (required)>'
vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/commands.rb:50:in `tap'
vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
#pref is not declared as a string just by assigning it " ".
Try this:
preferences = String.new
if !params[:prefgirl].nil?
preferences = preferences + "Girl,"
end
.
.
.
#preferences = preferences
Thanks for posting the code. If the stack trace is pointing to the right place, the error is here, where you're building a string like this:
"cv__Contact__c = '" + current_user.convio_id + "' AND Child_Status__c = 'Sponsored' and cv__Recurring_Gift_Status__c='Active'"
If current_user.convio_id is nil, you will get the error you cite. You should think about either guarding against current_user.convio_id being nil, or how that query should be built if it is.
A more Rubyish way to build that string, by the way, is using interpolation:
"cv__Contact__c = '#{current_user.convio_id}' AND Child_Status__c = 'Sponsored' and cv__Recurring_Gift_Status__c='Active'"
The error specifically means that current_user.convio_id is nil, and Ruby will not convert nil to a string without being told directly to. The + concatenates strings if the object on the left side is a string.
It seems that your whole sponsorship action depends on the user having a convio_id If that is a field that all users should have you should add a not null attribute to it, and go through and add one to all that don't have one currently.
If a convio_id is an optional thing you should check at the beginning of the action if they have one ex-
def sponsorships
if current_user.convio_id.nil?
flash[:convio_id] = "User has no Convio ID" # optional message saying why we're redirecting
redirect_to <somewhere else> and return
end
<rest of the code here>
To add a field as required in Ruby, ignoring the database, you would need to add this line in to your model, probably app/models/user.rb
class User < ActiveRecord::Base
...
validates :convio_id, presence: true
...
end
This will make it so all users created through the website must have a convio_id to be valid and saved.

Can't Install warbler ruby gem

I am running Ubuntu 11.10, jruby 1.4.0, ruby 1.8.7.174, rubygems 1.3.5, rails 2.3.4
I am working on a project that requires those specific versions of jruby, and Rails, along with glassfish server. The issue I am having is that when I start up glasfish,interminal it shows:
Missing these required gems:
warbler >= 1.2.1
...
Run `rake gems:install` to install the missing gems.
so I run jruby -S rake gems:install
And I get the output:
tlb rake task creation failed!, make sure you have installed the tlb-rspec1 gem
[Braintree] The SSL Certificate for the Sandbox environment will expire on 2010-12-01. Please check for an updated client library.
[Braintree] The SSL Certificate for the Production environment will expire on 2012-01-08. Please check for an updated client library.
jruby -S gem install warbler --version ">= 1.2.1"
System.java:-2:in `arraycopy': java.lang.ArrayIndexOutOfBoundsException
from DefaultResolver.java:111:in `makeTime'
from DefaultResolver.java:277:in `create'
from DefaultResolver.java:317:in `handleScalar'
from DefaultResolver.java:435:in `orgHandler'
from DefaultResolver.java:455:in `node_import'
from org/yecht/ruby/DefaultResolver$s_method_1_0$RUBYINVOKER$node_import.gen:-1:in `call'
from CachingCallSite.java:147:in `call'
from RubyLoadHandler.java:39:in `handle'
from Parser.java:300:in `addNode'
from DefaultYAMLParser.java:676:in `yyparse'
from Parser.java:290:in `yechtparse'
from Parser.java:284:in `parse'
from YParser.java:152:in `load'
from org/yecht/ruby/YParser$s_method_0_1$RUBYINVOKER$load.gen:-1:in `call'
from JavaMethod.java:623:in `call'
from DynamicMethod.java:176:in `call'
from CachingCallSite.java:310:in `cacheAndCall'
from CachingCallSite.java:149:in `call'
from CallOneArgNode.java:57:in `interpret'
from LocalAsgnNode.java:123:in `interpret'
from NewlineNode.java:104:in `interpret'
from InterpretedMethod.java:173:in `call'
from DefaultMethod.java:169:in `call'
from CachingCallSite.java:310:in `cacheAndCall'
from CachingCallSite.java:149:in `call'
from CallOneArgNode.java:57:in `interpret'
from LocalAsgnNode.java:123:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from InterpretedMethod.java:173:in `call'
from DefaultMethod.java:169:in `call'
from CachingCallSite.java:310:in `cacheAndCall'
from CachingCallSite.java:149:in `call'
from CallOneArgNode.java:57:in `interpret'
from NewlineNode.java:104:in `interpret'
from RescueNode.java:225:in `executeBody'
from RescueNode.java:147:in `interpretWithJavaExceptions'
from RescueNode.java:110:in `interpret'
from InterpretedMethod.java:173:in `call'
from DefaultMethod.java:169:in `call'
from CachingCallSite.java:310:in `cacheAndCall'
from CachingCallSite.java:149:in `call'
from FCallOneArgNode.java:36:in `interpret'
from InstAsgnNode.java:95:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from EnsureNode.java:96:in `interpret'
from BeginNode.java:83:in `interpret'
from NewlineNode.java:104:in `interpret'
from WhenOneArgNode.java:36:in `whenSlowTest'
from WhenOneArgNode.java:46:in `when'
from CaseNode.java:133:in `interpret'
from NewlineNode.java:104:in `interpret'
from InterpretedBlock.java:317:in `evalBlockBody'
from InterpretedBlock.java:268:in `yield'
from Block.java:194:in `yield'
from YieldNode.java:112:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from InterpretedBlock.java:317:in `evalBlockBody'
from InterpretedBlock.java:268:in `yield'
from Block.java:194:in `yield'
from RubyKernel.java:1182:in `loop_1_9'
from org/jruby/RubyKernel$s_method_0_0$RUBYFRAMEDINVOKER$loop_1_9.gen:-1:in `call'
from CachingCallSite.java:300:in `cacheAndCall'
from CachingCallSite.java:118:in `callBlock'
from CachingCallSite.java:133:in `callIter'
from FCallNoArgBlockNode.java:32:in `interpret'
from NewlineNode.java:104:in `interpret'
from InterpretedMethod.java:155:in `call'
from DefaultMethod.java:161:in `call'
from CachingCallSite.java:300:in `cacheAndCall'
from CachingCallSite.java:118:in `callBlock'
from CachingCallSite.java:123:in `call'
from CallNoArgBlockNode.java:64:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from InterpretedMethod.java:229:in `call'
from DefaultMethod.java:193:in `call'
from CachingCallSite.java:340:in `cacheAndCall'
from CachingCallSite.java:198:in `callBlock'
from CachingCallSite.java:203:in `call'
from RubyClass.java:720:in `call'
from DynamicMethod.java:184:in `call'
from WrapperMethod.java:62:in `call'
from CachingCallSite.java:330:in `cacheAndCall'
from CachingCallSite.java:189:in `call'
from FCallTwoArgNode.java:38:in `interpret'
from LocalAsgnNode.java:123:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from EnsureNode.java:96:in `interpret'
from InterpretedMethod.java:229:in `call'
from DefaultMethod.java:193:in `call'
from CachingCallSite.java:340:in `cacheAndCall'
from CachingCallSite.java:198:in `callBlock'
from CachingCallSite.java:203:in `call'
from CallTwoArgBlockPassNode.java:62:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from InterpretedMethod.java:266:in `call'
from DefaultMethod.java:209:in `call'
from CachingCallSite.java:360:in `cacheAndCall'
from CachingCallSite.java:238:in `callBlock'
from CachingCallSite.java:253:in `callIter'
from CallThreeArgBlockNode.java:64:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from InterpretedMethod.java:247:in `call'
from DefaultMethod.java:201:in `call'
from CachingCallSite.java:350:in `cacheAndCall'
from CachingCallSite.java:229:in `call'
from FCallThreeArgNode.java:40:in `interpret'
from LocalAsgnNode.java:123:in `interpret'
from NewlineNode.java:104:in `interpret'
from InterpretedBlock.java:317:in `evalBlockBody'
from InterpretedBlock.java:268:in `yield'
from Block.java:194:in `yield'
from RubyIO.java:1067:in `open'
from RubyKernel.java:284:in `open'
from org/jruby/RubyKernel$s_method_0_2$RUBYFRAMEDINVOKER$open.gen:-1:in `call'
from DynamicMethod.java:188:in `call'
from CachingCallSite.java:340:in `cacheAndCall'
from CachingCallSite.java:198:in `callBlock'
from CachingCallSite.java:213:in `callIter'
from FCallTwoArgBlockNode.java:34:in `interpret'
from NewlineNode.java:104:in `interpret'
from IfNode.java:119:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from InterpretedMethod.java:210:in `call'
from DefaultMethod.java:185:in `call'
from CachingCallSite.java:330:in `cacheAndCall'
from CachingCallSite.java:189:in `call'
from CallTwoArgNode.java:59:in `interpret'
from InstAsgnNode.java:95:in `interpret'
from NewlineNode.java:104:in `interpret'
from RescueNode.java:225:in `executeBody'
from RescueNode.java:147:in `interpretWithJavaExceptions'
from RescueNode.java:110:in `interpret'
from BeginNode.java:83:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from InterpretedMethod.java:229:in `call'
from DefaultMethod.java:193:in `call'
from CachingCallSite.java:340:in `cacheAndCall'
from CachingCallSite.java:198:in `callBlock'
from CachingCallSite.java:203:in `call'
from RubyClass.java:720:in `call'
from DynamicMethod.java:184:in `call'
from CachingCallSite.java:330:in `cacheAndCall'
from CachingCallSite.java:189:in `call'
from CallTwoArgNode.java:59:in `interpret'
from DAsgnNode.java:110:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from InterpretedBlock.java:317:in `evalBlockBody'
from InterpretedBlock.java:268:in `yield'
from Block.java:194:in `yield'
from RubyArray.java:1635:in `eachCommon'
from RubyArray.java:1642:in `each'
from org/jruby/RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$each.gen:-1:in `call'
from CachingCallSite.java:300:in `cacheAndCall'
from CachingCallSite.java:118:in `callBlock'
from CachingCallSite.java:123:in `call'
from CallNoArgBlockNode.java:64:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from InterpretedMethod.java:210:in `call'
from DefaultMethod.java:185:in `call'
from CachingCallSite.java:330:in `cacheAndCall'
from CachingCallSite.java:189:in `call'
from CallTwoArgNode.java:59:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from RescueNode.java:225:in `executeBody'
from RescueNode.java:147:in `interpretWithJavaExceptions'
from RescueNode.java:110:in `interpret'
from BeginNode.java:83:in `interpret'
from NewlineNode.java:104:in `interpret'
from InterpretedBlock.java:317:in `evalBlockBody'
from InterpretedBlock.java:268:in `yield'
from Block.java:194:in `yield'
from RubyArray.java:1635:in `eachCommon'
from RubyArray.java:1642:in `each'
from org/jruby/RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$each.gen:-1:in `call'
from CachingCallSite.java:300:in `cacheAndCall'
from CachingCallSite.java:118:in `callBlock'
from CachingCallSite.java:123:in `call'
from CallNoArgBlockNode.java:64:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from InterpretedMethod.java:136:in `call'
from DefaultMethod.java:153:in `call'
from CachingCallSite.java:290:in `cacheAndCall'
from CachingCallSite.java:109:in `call'
from VCallNode.java:85:in `interpret'
from NewlineNode.java:104:in `interpret'
from IfNode.java:119:in `interpret'
from IfNode.java:119:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from InterpretedMethod.java:247:in `call'
from DefaultMethod.java:201:in `call'
from CachingCallSite.java:350:in `cacheAndCall'
from CachingCallSite.java:229:in `call'
from CallSpecialArgNode.java:71:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from CaseNode.java:138:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from InterpretedMethod.java:173:in `call'
from DefaultMethod.java:169:in `call'
from CachingCallSite.java:310:in `cacheAndCall'
from CachingCallSite.java:149:in `call'
from FCallOneArgNode.java:36:in `interpret'
from NewlineNode.java:104:in `interpret'
from RescueNode.java:225:in `executeBody'
from RescueNode.java:147:in `interpretWithJavaExceptions'
from RescueNode.java:110:in `interpret'
from InterpretedMethod.java:173:in `call'
from DefaultMethod.java:169:in `call'
from CachingCallSite.java:310:in `cacheAndCall'
from CachingCallSite.java:149:in `call'
from CallOneArgNode.java:57:in `interpret'
from NewlineNode.java:104:in `interpret'
from BlockNode.java:71:in `interpret'
from InterpretedMethod.java:173:in `call'
from DefaultMethod.java:169:in `call'
from CachingCallSite.java:310:in `cacheAndCall'
from CachingCallSite.java:149:in `call'
from gem:24:in `rescue_1$RUBY$__rescue___0'
from gem:23:in `__file__'
from gem:-1:in `load'
from Ruby.java:628:in `runScript'
from Ruby.java:550:in `runNormally'
from Ruby.java:396:in `runFromMain'
from Main.java:272:in `run'
from Main.java:117:in `run'
from Main.java:97:in `main'
I also tried jruby -S gem install warbler -v 1.2.1, and jgem install warbler -v 1.2.1
With the same result
The first line of the error message says:
tlb rake task creation failed!, make sure you have installed the tlb-rspec1 gem
Have you tried doing this?
This sounds like a bug in yecht. It may be this one: http://bug.jruby.org/5581 (Though it is rather strange that you are getting this in 1.4.0.)
There are a couple of options, assuming that you are stuck with JRuby 1.4.0:
Check out yecht source from https://github.com/olabini/yecht, build yecht.jar, insert it into JRuby 1.4.0 source's lib/ruby/site_ruby/shared/yecht.jar, and rebuild jruby.jar. This might (or might not) get you JRuby 1.4.0 with the fix.
Try Bundler. It might work with Rails 2.3.4: http://gembundler.com/rails23.html

Resources