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.
Related
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
I have inherited a rails application that I am supposed to debug and get up running, but the thing is I am not to familiar with rails. I have done research on the error on here and other places, but I still do not know how to fix this error.
here is the code for my calculate model
class Calculation < ActiveRecord::Base
belongs_to :user
has_many :calculation_expenses, dependent: :delete_all
has_many :user_account_stats, dependent: :delete_all
accepts_nested_attributes_for :calculation_expenses
def self.calculate_for(user, period = 'weeks', periods_count = 5*53 - 1)
user_accounts = {}
checking_ids = []
total_checking = 0
total_expense_per_account = {}
user.user_accounts.each do |ua|
total_expense_per_account[ua.id] = 0
user_accounts[ua.id] = ua.amount
if ua.is_checking?
checking_ids << ua.id
total_checking = total_checking + ua.amount
end
end
monthly = false
monthly = true if period == 'months'
user.user_account_stats.where('calculations.is_monthly = ?', monthly).delete_all
user.calculation_expenses.where('calculations.is_monthly = ?', monthly).delete_all
IncomeStat.where('income_id IN (?)', user.incomes.map(&:id)).delete_all
user.calculations.where(is_monthly: monthly).delete_all
calcs = []
calcs_expenses = []
accounts_stats = []
income_stats = []
left_to_bugdet = []
expenses = user.expenses.to_a
incomes = user.incomes.where(is_system: false).to_a
system_income_id = user.incomes.where(is_system: true).first.id
goals = user.expenses.where(is_goal: true).reorder('rank_of_priority ASC').to_a
goal_ids = goals.map(&:id)
current_goals_balance = {}
current_expenses_total = {}
goal_payments_made = {}
goal_monthly_override = {} #using this for loan payments with extra payed sum
loan_pay_off = {}
expenses_monthly = {}
expenses.each do |expense|
current_expenses_total[expense.id] = 0
expenses_monthly[expense.id] = expense.amount
end
start_dt = Date.today
start_dt += 1 + ((5 - start_dt.wday) % 7)
# firstly we need to calculate all incomes and expenses
for i in 0..periods_count
week_start = start_dt + i.send(period)
week_end = week_start + 1.send(period) - 1.day
total_income = 0
total_expense = 0
current_expenses = {}
scheduled_expenses = {}
expense_per_account = {}
user_accounts.each_pair do |key, amount|
expense_per_account[key] = 0
end
incomes.each do |income| #add incomes
cnt = income.exists_between week_start, week_end
income_amount = cnt * income.amount
total_income = total_income + income_amount
income_stats << [income_amount, income.id]
user_accounts[income.user_account_id] = user_accounts[income.user_account_id] + income_amount
if checking_ids.include? income.user_account_id
total_checking = total_checking + income_amount
end
end
income_stats << [0, system_income_id]
expenses.each do |expense| #substract expenses
cnt = expense.exists_between week_start, week_end
scheduled_expenses[expense.id] = (cnt > 0)
goal_payments_made[expense.id] ||= 0
goal_payments_made[expense.id] = goal_payments_made[expense.id] + cnt
ea = expense.amount
ea = goal_monthly_override[expense.id] unless goal_monthly_override[expense.id].nil?
expense_amount = cnt * ea
if expense.is_loan? && cnt > 0
loan_pay_off[expense.id] ||= 0
if expense.get_debt_sum - loan_pay_off[expense.id] < expense_amount
expense_amount = (expense.get_debt_sum - loan_pay_off[expense.id]) * (1 + expense.interest / Frequency.get_interest_amount(expense.frequency_id) / 100.0)
end
loan_pay_off[expense.id] = loan_pay_off[expense.id] + expense.get_main_part(loan_pay_off[expense.id], expense_amount)
end
if checking_ids.include? expense.user_account_id
total_expense = total_expense + expense_amount
end
user_accounts[expense.user_account_id] = user_accounts[expense.user_account_id] - expense_amount
current_expenses[expense.id] = expense_amount
expense_per_account[expense.user_account_id] = expense_per_account[expense.user_account_id] + expense_amount
if checking_ids.include? expense.user_account_id
total_checking = total_checking - expense_amount
end
current_expenses_total[expense.id] = current_expenses_total[expense.id] + expense_amount
total_expense_per_account[expense.user_account_id] = total_expense_per_account[expense.user_account_id] + expense_amount
end
extra_money = total_checking - user.minimum_safety_level
j = i - 1
while extra_money < 0 && j > 0 do #respect minimum safety level by reducing extra money levels on previous periods
reduce_extra = -extra_money
if calcs[j][5] < reduce_extra
reduce_extra = calcs[j][5]
end
calcs[j][5] = calcs[j][5] - reduce_extra
extra_money = extra_money + reduce_extra
calcs[i]
j = j - 1
end
extra_money = 0 if extra_money < 0
calcs << [week_end, user.id, total_income, total_expense, monthly, extra_money]
current_expenses.each_pair do |expense_id, budgeted|
calcs_expenses << [expense_id, budgeted, nil, current_expenses_total[expense_id], loan_pay_off[expense_id] || 0, scheduled_expenses[expense_id], expenses_monthly[expense_id]]
end
a = [] #temporary save stats
user_accounts.each_pair do |user_account_id, amount|
a << [user_account_id, amount, amount, expense_per_account[user_account_id], nil, total_expense_per_account[user_account_id]]
end
accounts_stats << a
end
extra_payments_data = []
accounts_stats = accounts_stats.map { |a| a }.sum
self.save_data(user, monthly, expenses.size, calcs, calcs_expenses, extra_payments_data, accounts_stats, income_stats)
#find last calculation without extra money
last_zero = Calculation.where(user_id: user.id, is_monthly: monthly, extra_money: 0).reorder('dt DESC').first
## remove local extra money before last zero - we cannot spend them
unless last_zero.nil?
Calculation.where(user_id: user.id, is_monthly: monthly).where('id < ?', last_zero.id).update_all extra_money: 0
# # find an extra money we can spend
em_count = Calculation.where(user_id: user.id, is_monthly: monthly).where('extra_money > 0').count
g = 0
id = 0
while em_count > 0 && g < periods_count - 1 do
calc = Calculation.where(user_id: user.id, is_monthly: monthly).where('extra_money > 0 AND id > ?', id).reorder('extra_money ASC').first
unless calc.nil?
goals.each do |goal|
unless goal.ends_before? calc.dt
ce = calc.calculation_expenses.where(expense_id: goal.id).first
amount = goal.aggressiveness / 100.0 * calc.extra_money
goal_left = goal.get_debt_sum - ce.paid_off
amount = goal_left if goal_left < amount
if amount > 0
ce.update_budgeted ce.budgeted + amount
end
end
end
g = g + 1
puts "#{g} of #{periods_count}"
id = calc.id
#find last calculation without extra money
last_zero = Calculation.where(user_id: user.id, is_monthly: monthly, extra_money: 0).reorder('dt DESC').first
# remove local extra money before last zero - we cannot spend them
Calculation.where(user_id: user.id, is_monthly: monthly).where('id < ?', last_zero.id).update_all extra_money: 0
else
g = periods_count
end
end
end
end
def self.save_data(user, monthly, expenses_count, calcs, calcs_expenses, extra_payments_data, accounts_stats, income_stats, dt = nil)
# write calculations to database
Calculation.import([:dt, :user_id, :total_income, :total_expense, :is_monthly, :extra_money], calcs, validate: false)
# write calculation ids to arrays
if dt.nil?
ids = user.calculations.where(is_monthly: monthly).pluck(:id)
else
ids = user.calculations.where(is_monthly: monthly).where('dt >= ?', dt).pluck(:id)
end
cur_ind = 0
cur_ind2 = 0
cur_ind3 = 0
num = expenses_count
num2 = user.incomes.count
num3 = user.user_accounts.size
ids.each_with_index do |id, ind|
num.times do
calcs_expenses[cur_ind] << ids[ind]
cur_ind = cur_ind + 1
end
num2.times do
income_stats[cur_ind2] << ids[ind]
cur_ind2 = cur_ind2 + 1
end
num3.times do
accounts_stats[cur_ind3] << ids[ind]
cur_ind3 = cur_ind3 + 1
end
end
# write all data with 2 queries
UserAccountStat::import([:user_account_id, :amount, :initial_amount, :budgeted, :actual, :total, :calculation_id], accounts_stats, validate: false)
CalculationExpense::import([:expense_id, :budgeted, :actual, :total, :paid_off, :is_scheduled, :monthly_payment, :calculation_id], calcs_expenses, validate: false)
IncomeStat::import([:amount, :income_id, :calculation_id], income_stats, validate: false)
user.expenses_groups.each do |group|
group.calculate_data
end
end
def as_json(options)
{
id: self.id,
total_income: self.total_income,
total_expense: self.total_expense,
extra_money: self.extra_money,
dt: self.dt
}
end
end
Here is my calculation controller
class CalculationsController < ApplicationController
def index
unless current_user.calculations.any?
redirect_to '/calculate'
end
end
def load
respond_to do |format|
format.json { render json: get_data }
end
end
def calc
Calculation.calculate_for(current_user)
redirect_to calculations_path
end
def update
#calc = current_user.calculation_expenses.where(id: params[:id]).first
#calc.update_actual params[:value]
respond_to do |format|
format.json { render json: get_data }
end
end
def update_budgeted
#calc = current_user.calculation_expenses.where(id: params[:id]).first
#calc.update_budgeted params[:value]
respond_to do |format|
format.json { render json: get_data }
end
end
def group
if params[:id].blank?
#group = ExpensesGroup.create(name: params[:name], user_id: current_user.id)
else
#group = current_user.expenses_groups.where(id: params[:id]).first
unless #group.nil?
#group.update_attribute :name, params[:name]
end
end
end
end
When I run the application locally I can see that the problem is with this line in the calculate_for method in the calculation model
system_income_id = user.incomes.where(is_system: true).first.id
and with this line in the cal method of the calculation control
Calculation.calculate_for(current_user)
Here is the error log from rails console
NoMethodError - undefined method `id' for nil:NilClass:
app/models/calculation.rb:36:in `calculate_for'
app/controllers/calculations_controller.rb:16:in `calc'
actionpack (4.2.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.3) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.3) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.3) lib/active_support/callbacks.rb:115:in `call'
activesupport (4.2.3) lib/active_support/callbacks.rb:553:in `block (2 levels) in compile'
activesupport (4.2.3) lib/active_support/callbacks.rb:503:in `call'
activesupport (4.2.3) lib/active_support/callbacks.rb:88:in `run_callbacks'
actionpack (4.2.3) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.3) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.3) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.3) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.3) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.3) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.3) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.3) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.3) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.3) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.3) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.3) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:45:in `serve'
actionpack (4.2.3) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.3) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:821:in `call'
meta_request (0.3.0) lib/meta_request/middlewares /app_request_handler.rb:13:in `call'
rack-contrib (1.1.0) lib/rack/contrib/response_headers.rb:17:in `call'
meta_request (0.3.0) lib/meta_request/middlewares/headers.rb:16:in `call'
meta_request (0.3.0) lib/meta_request/middlewares /meta_request_handler.rb:13:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.6.4) lib/rack/etag.rb:24:in `call'
rack (1.6.4) lib/rack/conditionalget.rb:25:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.3) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
activerecord (4.2.3) lib/active_record/migration.rb:377:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.3) lib/active_support/callbacks.rb:84:in `run_callbacks'
actionpack (4.2.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
better_errors (2.1.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:57:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.2.1) lib/web_console/middleware.rb:39:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.3) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.3) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.3) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.3) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.3) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.3) lib/rails/rack/logger.rb:20:in `call'
quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets'
actionpack (4.2.3) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.3) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/static.rb:116:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.3) lib/rails/engine.rb:518:in `call'
railties (4.2.3) lib/rails/application.rb:165:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
/home/xwattsh/.rbenv/versions/2.2.3/lib/ruby/2.2.0/webrick /httpserver.rb:138:in `service'
/home/xwattsh/.rbenv/versions/2.2.3/lib/ruby/2.2.0/webrick /httpserver.rb:94:in `run'
/home/xwattsh/.rbenv/versions/2.2.3/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
=>This line is not safe:
system_income_id = user.incomes.where(is_system: true).first.id
It will cause an exception when the user have no income where is_system is set to true.
You can either check if the .first is nil or not, or put it in a try/catch block. Either case, it depends on you to handle the case where .first do not exist.
ex.
first_system_income = user.incomes.where(is_system: true).first
if first_system_income.present?
//do your normal stuff here
else
//handle the exception case
end
or (not recommended)
begin
system_income_id = user.incomes.where(is_system: true).first.id
rescue => e
//handle the exception case
puts e
end
On a separate note, that's some serious logic in one method! Maybe some comments or refactor would help, now that you inherited the project :)
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/
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.
On my prod server I'm getting Missing template exceptions sometime.
The setup is VPN with CentOS5, ruby 1.9.2, Rails 3.2.1, 8 nginx instances, 6 thin instances
So, this happens with two main views, happens rarely, approx. 1 time per 1000 requests, but it is
As I understand thin recieves the request and just process with real exception, but I cannot realize why, because 999 of 1000 other request are ok and they must be ok.
Is this a filesystem issue? or smth with locale from bots?
exception example is here:
From: Exception Notifier <myhost>
Subject: [myhost Exception] controllername#actionname (ActionView::MissingTemplate) "Missing
template controllername/actionname, application/actionname with {:locale=>[...
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Gm-Message-State: ALoCoQn4St5gK1z...
A ActionView::MissingTemplate occurred in controllername#actionname:
Missing template controllername/actionname, application/actionname with {:locale=3D>[:en], :fo=
rmats=3D>[:html], :handlers=3D>[:erb, :builder, :coffee, :haml]}. Searche=
d in:
* "/..mypath../releases/20120205001108/app/views"
actionpack (3.2.1) lib/action_view/path_set.rb:58:in `find'
-------------------------------
Request:
-------------------------------
* URL : http://myhost/actionurl
* IP address: 74.208.8.48
* Parameters: {"utf8"=3D>"=E2=9C=93", "authenticity_token"=3D>"Ffkm6Bd8=
wi3+Got7uTeLhzj86hJNDpFYRjG4Yrqx4yQ=3D", "video_link"=3D>"", "controller"=
=3D>"controllername", "action"=3D>"actionname"}
* Rails root: /..mypath../releases/20120205001108
-------------------------------
Session:
-------------------------------
* session id: "0c7c55faac70eb0632139de299ccdc9a"
* data: {"session_id"=3D>"0c7c55faac70eb0632139de299ccdc9a",
"_csrf_token"=3D>"Ffkm6Bd8wi3+Got7uTeLhzj86hJNDpFYRjG4Yrqx4yQ=3D"}
-------------------------------
Environment:
-------------------------------
* CONTENT_LENGTH : 94
* CONTENT_TYPE : application/x-www-fo=
rm-urlencoded
* GATEWAY_INTERFACE : CGI/1.2
* HTTP_ACCEPT : image/gif, image/x-x=
bitmap, image/jpeg, image/pjpeg, */*
* HTTP_ACCEPT_ENCODING : gzip, deflate
* HTTP_ACCEPT_LANGUAGE : en-us
* HTTP_CONNECTION : close
* HTTP_COOKIE : _myhost_session=3DBA=
h7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTBjN2M1NWZhYWM3MGViMDYzMjEzOWRlMjk5Y2NkYzl=
hBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUZma202QmQ4d2kzK0dvdDd1VGVMaHpqODZoSk5E=
cEZZUmpHNFlycXg0eVE9BjsARg%3D%3D--7766b6f664ae053b5682f046ad3531e5a41bcdf=
d
* HTTP_HOST : myhost
* HTTP_MAX_FORWARDS : 10
* HTTP_PRAGMA : no-cache
* HTTP_REFERER : http://myhost/
* HTTP_USER_AGENT : Mozilla/4.0 (compati=
ble; MSIE 6.0; Windows NT 5.1)
* HTTP_VERSION : HTTP/1.0
* HTTP_X_FORWARDED_FOR : 74.208.8.48
* HTTP_X_REAL_IP : 74.208.8.48
* ORIGINAL_FULLPATH : /actionurl
* PATH_INFO : /actionurl
* QUERY_STRING : =
* REMOTE_ADDR : 127.0.0.1
* REQUEST_METHOD : POST
* REQUEST_PATH : /actionurl
* REQUEST_URI : /actionurl
* SCRIPT_NAME : =
* SERVER_NAME : myhost
* SERVER_PORT : 80
* SERVER_PROTOCOL : HTTP/1.1
* SERVER_SOFTWARE : thin 1.3.1 codename =
Triple Espresso
* action_controller.instance : controllername#actionname
* action_dispatch.backtrace_cleaner : #<Rails::BacktraceCl=
eaner:0xab76b14>
* action_dispatch.cookies : #<ActionDispatch::Co=
okies::CookieJar:0xcaedac4>
* action_dispatch.logger : #<ActiveSupport::Tag=
gedLogging:0xadb7874>
* action_dispatch.parameter_filter : [:password, /RAW_POS=
T_DATA/, /RAW_POST_DATA/, /RAW_POST_DATA/, /RAW_POST_DATA/, /RAW_POST_DAT=
A/, /RAW_POST_DATA/, /RAW_POST_DATA/, /RAW_POST_DATA/, /RAW_POST_DATA/, /=
RAW_POST_DATA/, /RAW_POST_DATA/, /RAW_POST_DATA/, /RAW_POST_DATA/, /RAW_P=
OST_DATA/, /RAW_POST_DATA/, /RAW_POST_DATA/, /RAW_POST_DATA/]
* action_dispatch.remote_ip : 74.208.8.48
* action_dispatch.request.content_type : application/x-www-fo=
rm-urlencoded
* action_dispatch.request.formats : [text/html]
* action_dispatch.request.parameters : {"utf8"=3D>"=E2=9C=93=
", "authenticity_token"=3D>"Ffkm6Bd8wi3+Got7uTeLhzj86hJNDpFYRjG4Yrqx4yQ=3D=
", "someparam"=3D>"", "controller"=3D>"controllername", "action"=3D>"actionname"}
* action_dispatch.request.path_parameters : {:controller=3D>"controllername", :action=3D>"actionname"}
* action_dispatch.request.query_parameters : {}
* action_dispatch.request.request_parameters : {"utf8"=3D>"=E2=9C=93=
", "authenticity_token"=3D>"Ffkm6Bd8wi3+Got7uTeLhzj86hJNDpFYRjG4Yrqx4yQ=3D=
", "video_link"=3D>""}
* action_dispatch.request.unsigned_session_cookie: {"session_id"=3D>"0c=
7c55faac70eb0632139de299ccdc9a", "_csrf_token"=3D>"Ffkm6Bd8wi3+Got7uTeLhz=
j86hJNDpFYRjG4Yrqx4yQ=3D"}
* action_dispatch.request_id : 3e96f7bca9fc30f3e4eb=
1d91e61a63c0
* action_dispatch.routes : #<ActionDispatch::Ro=
uting::RouteSet:0xb0b029c>
* action_dispatch.secret_token : 20b9fbcf1214f8f88d5e=
549c61892c2558dffbe59db6c9dda63c84554af6d628248f3fd5217eb12e47df41260789a=
e59ad359b67e2309e5832390244777d56a7
* action_dispatch.show_detailed_exceptions : false
* action_dispatch.show_exceptions : true
* async.callback : #<Method: Thin::Unix=
Connection(Thin::Connection)#post_process>
* async.close : #<EventMachine::Defa=
ultDeferrable:0xcacf7a4>
* exception_notifier.options : {:sender_address=3D>=
"\"myhost Exception Notifier\" <exception#email>", :exception_recipients=3D>=
["exception#email"], :email_prefix=3D>"[myhost Exception] ", :sections=3D>["=
request", "session", "environment", "backtrace"], :ignore_exceptions=3D>[=
ActiveRecord::RecordNotFound, AbstractController::ActionNotFound, ActionC=
ontroller::RoutingError]}
* rack-cache.allow_reload : false
* rack-cache.allow_revalidate : false
* rack-cache.cache_key : Rack::Cache::Key
* rack-cache.default_ttl : 0
* rack-cache.entitystore : rails:/
* rack-cache.metastore : rails:/
* rack-cache.private_headers : ["Authorization", "C=
ookie"]
* rack-cache.storage : #<Rack::Cache::Stora=
ge:0xc2b79b8>
* rack-cache.use_native_ttl : false
* rack-cache.verbose : true
* rack.errors : #<IO:0x99b5b50>
* rack.input : #<StringIO:0xcaa0bac=
>
* rack.multiprocess : false
* rack.multithread : false
* rack.request.cookie_hash : {"_myhost_session"=3D=
>"BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTBjN2M1NWZhYWM3MGViMDYzMjEzOWRlMjk5Y2N=
kYzlhBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUZma202QmQ4d2kzK0dvdDd1VGVMaHpqODZo=
Sk5EcEZZUmpHNFlycXg0eVE9BjsARg=3D=3D--7766b6f664ae053b5682f046ad3531e5a41=
bcdfd"}
* rack.request.cookie_string : _myhost_session=3DBA=
h7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTBjN2M1NWZhYWM3MGViMDYzMjEzOWRlMjk5Y2NkYzl=
hBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUZma202QmQ4d2kzK0dvdDd1VGVMaHpqODZoSk5E=
cEZZUmpHNFlycXg0eVE9BjsARg%3D%3D--7766b6f664ae053b5682f046ad3531e5a41bcdf=
d
* rack.request.form_hash : {"utf8"=3D>"=E2=9C=93=
", "authenticity_token"=3D>"Ffkm6Bd8wi3+Got7uTeLhzj86hJNDpFYRjG4Yrqx4yQ=3D=
", "someparam"=3D>""}
* rack.request.form_input : #<StringIO:0xcaa0bac=
>
* rack.request.form_vars : utf8=3D%E2%9C%93&aut=
henticity_token=3DFfkm6Bd8wi3%2BGot7uTeLhzj86hJNDpFYRjG4Yrqx4yQ%3D&video_=
link=3D
* rack.request.query_hash : {}
* rack.request.query_string : =
* rack.run_once : false
* rack.session : {"session_id"=3D>"0c=
7c55faac70eb0632139de299ccdc9a", "_csrf_token"=3D>"Ffkm6Bd8wi3+Got7uTeLhz=
j86hJNDpFYRjG4Yrqx4yQ=3D"}
* rack.session.options : {:path=3D>"/", :doma=
in=3D>nil, :expire_after=3D>nil, :secure=3D>false, :httponly=3D>true, :de=
fer=3D>false, :renew=3D>false, :coder=3D>#<Rack::Session::Cookie::Base64:=
:Marshal:0xc26f410>, :id=3D>"0c7c55faac70eb0632139de299ccdc9a"}
* rack.url_scheme : http
* rack.version : [1, 0]
=
* Process: 13504
* Server : myserver
-------------------------------
Backtrace:
-------------------------------
actionpack (3.2.1) lib/action_view/path_set.rb:58:in `find'
actionpack (3.2.1) lib/action_view/lookup_context.rb:109:in `find'
actionpack (3.2.1) lib/action_view/renderer/abstract_renderer.rb:3:in `=
find_template'
actionpack (3.2.1) lib/action_view/renderer/template_renderer.rb:28:in =
`determine_template'
actionpack (3.2.1) lib/action_view/renderer/template_renderer.rb:10:in =
`render'
actionpack (3.2.1) lib/action_view/renderer/renderer.rb:36:in `render_t=
emplate'
actionpack (3.2.1) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.1) lib/abstract_controller/rendering.rb:109:in `_render=
_template'
actionpack (3.2.1) lib/action_controller/metal/streaming.rb:225:in `_re=
nder_template'
actionpack (3.2.1) lib/abstract_controller/rendering.rb:103:in `render_=
to_body'
actionpack (3.2.1) lib/action_controller/metal/renderers.rb:28:in `rend=
er_to_body'
actionpack (3.2.1) lib/action_controller/metal/compatibility.rb:50:in `=
render_to_body'
actionpack (3.2.1) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.1) lib/action_controller/metal/rendering.rb:16:in `rend=
er'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:40:in=
`block (2 levels) in render'
activesupport (3.2.1) lib/active_support/core_ext/benchmark.rb:5:in `bl=
ock in ms'
/usr/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'
activesupport (3.2.1) lib/active_support/core_ext/benchmark.rb:5:in `ms=
'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:40:in=
`block in render'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:83:in=
`cleanup_view_runtime'
activerecord (3.2.1) lib/active_record/railties/controller_runtime.rb:2=
4:in `cleanup_view_runtime'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:39:in=
`render'
actionpack (3.2.1) lib/action_controller/metal/implicit_render.rb:10:in=
`default_render'
actionpack (3.2.1) lib/action_controller/metal/implicit_render.rb:5:in =
`send_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:167:in `process_acti=
on'
actionpack (3.2.1) lib/action_controller/metal/rendering.rb:10:in `proc=
ess_action'
actionpack (3.2.1) lib/abstract_controller/callbacks.rb:18:in `block in=
process_action'
activesupport (3.2.1) lib/active_support/callbacks.rb:414:in `_run__858=
933213__process_action__417312363__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_cal=
lback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_proc=
ess_action_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callba=
cks'
actionpack (3.2.1) lib/abstract_controller/callbacks.rb:17:in `process_=
action'
actionpack (3.2.1) lib/action_controller/metal/rescue.rb:29:in `process=
_action'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:30:in=
`block in process_action'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `block=
in instrument'
activesupport (3.2.1) lib/active_support/notifications/instrumenter.rb:=
20:in `instrument'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `instr=
ument'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:29:in=
`process_action'
actionpack (3.2.1) lib/action_controller/metal/params_wrapper.rb:205:in=
`process_action'
activerecord (3.2.1) lib/active_record/railties/controller_runtime.rb:1=
8:in `process_action'
newrelic_rpm (3.3.1) lib/new_relic/agent/instrumentation/rails3/action_=
controller.rb:34:in `block in process_action'
newrelic_rpm (3.3.1) lib/new_relic/agent/instrumentation/controller_ins=
trumentation.rb:255:in `block in perform_action_with_newrelic_trace'
newrelic_rpm (3.3.1) lib/new_relic/agent/method_tracer.rb:242:in `trace=
_execution_scoped'
newrelic_rpm (3.3.1) lib/new_relic/agent/instrumentation/controller_ins=
trumentation.rb:250:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.3.1) lib/new_relic/agent/instrumentation/rails3/action_=
controller.rb:33:in `process_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.1) lib/abstract_controller/rendering.rb:45:in `process'=
actionpack (3.2.1) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal/rack_delegation.rb:14:in=
`dispatch'
actionpack (3.2.1) lib/action_controller/metal.rb:246:in `block in acti=
on'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `call=
'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `disp=
atch'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:30:in `call=
'
journey (1.0.1) lib/journey/router.rb:68:in `block in call'
journey (1.0.1) lib/journey/router.rb:56:in `each'
journey (1.0.1) lib/journey/router.rb:56:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:589:in `cal=
l'
newrelic_rpm (3.3.1) lib/new_relic/rack/browser_monitoring.rb:23:in `ca=
ll'
exception_notification (2.5.2) lib/exception_notifier.rb:25:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/best_standards_suppor=
t.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:35:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/params_parser.rb:21:i=
n `call'
actionpack (3.2.1) lib/action_dispatch/middleware/flash.rb:242:in `call=
'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in `ca=
ll'
activerecord (3.2.1) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/con=
nection_pool.rb:443:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `b=
lock in call'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__332=
759817__call__1023748432__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_cal=
lback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call=
_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callba=
cks'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `c=
all'
rack (1.4.1) lib/rack/sendfile.rb:102:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in `c=
all'
actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:1=
6:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56=
:in `call'
railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in `=
call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.1) lib/active_support/cache/strategy/local_cache.rb:=
72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
rack-cache (1.1) lib/rack/cache/context.rb:132:in `forward'
rack-cache (1.1) lib/rack/cache/context.rb:139:in `pass'
rack-cache (1.1) lib/rack/cache/context.rb:151:in `invalidate'
rack-cache (1.1) lib/rack/cache/context.rb:70:in `call!'
rack-cache (1.1) lib/rack/cache/context.rb:50:in `call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/application.rb:220:in `call'
railties (3.2.1) lib/rails/railtie/configurable.rb:30:in `method_missin=
g'
thin (1.3.1) lib/thin/connection.rb:80:in `block in pre_process'
thin (1.3.1) lib/thin/connection.rb:78:in `catch'
thin (1.3.1) lib/thin/connection.rb:78:in `pre_process'
thin (1.3.1) lib/thin/connection.rb:53:in `process'
thin (1.3.1) lib/thin/connection.rb:38:in `receive_data'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
thin (1.3.1) lib/thin/backends/base.rb:61:in `start'
thin (1.3.1) lib/thin/server.rb:159:in `start'
thin (1.3.1) lib/thin/controllers/controller.rb:86:in `start'
thin (1.3.1) lib/thin/runner.rb:185:in `run_command'
thin (1.3.1) lib/thin/runner.rb:151:in `run!'
thin (1.3.1) bin/thin:6:in `<top (required)>'
/..mypath../shared/bundle/ruby/1.9.1/bin/thin:19:in `load'
/..mypath../shared/bundle/ruby/1.9.1/bin/thin:19:in `<main>'
Is this supposed to be a POST request? That's what's showing up in the stacktrace:
REQUEST_METHOD : POST