Intermittent error - undefined method 'destroy_without_callb


#1

When testing my app locally I’m getting intermittent errors which are
driving me mad!

The error is:

NameError ((eval):1:in alias_method': undefined methoddestroy_without_callbacks’ for class `Exercise’):

Refreshing the browser sometimes fixes it, as does restarting WEBrick.
Annoying to debug as it only happens intermittently.

Any ideas on why this is happening, or indeed how to track it down?

Full traceback is as follows:

NameError ((eval):1:in alias_method': undefined methoddestroy_without_callbacks’ for class Exercise'): /vendor/rails/activerecord/lib/active_record/associations.rb:787:inclass_eval’
(eval):1:in class_eval' /vendor/rails/activerecord/lib/active_record/associations.rb:787:inclass_eval’
/vendor/rails/activerecord/lib/active_record/associations.rb:787:in
`has_and_belongs_to_many’
/app/models/exercise.rb:33

/vendor/rails/activesupport/lib/active_support/dependencies.rb:129:in
`load’

/vendor/rails/activesupport/lib/active_support/dependencies.rb:129:in
`load’

/vendor/rails/activesupport/lib/active_support/dependencies.rb:56:in
`rails_pre_engines_require_or_load’

/vendor/plugins/engines/lib/engines/dependencies_extensions.rb:52:in
`rails_1_1_require_or_load’

/vendor/plugins/engines/lib/engines/dependencies_extensions.rb:21:in
`rails_edge_require_or_load’

/vendor/plugins/engines/lib/engines/dependencies_extensions.rb:10:in
`require_or_load’

/vendor/rails/activesupport/lib/active_support/dependencies.rb:30:in
`depend_on’

/vendor/rails/activesupport/lib/active_support/dependencies.rb:36:in
`associate_with’

/vendor/rails/activesupport/lib/active_support/dependencies.rb:75:in
`require_association’

/vendor/rails/activesupport/lib/active_support/dependencies.rb:75:in
require_association' /vendor/rails/activerecord/lib/active_record/associations.rb:894:inrequire_association_class’
/vendor/rails/activerecord/lib/active_record/base.rb:981:in
instantiate_without_callbacks' /vendor/rails/activerecord/lib/active_record/callbacks.rb:215:ininstantiate’
/vendor/rails/activerecord/lib/active_record/base.rb:390:in
find_by_sql' /vendor/rails/activerecord/lib/active_record/base.rb:390:incollect!’
/vendor/rails/activerecord/lib/active_record/base.rb:390:in
find_by_sql' /vendor/rails/activerecord/lib/active_record/base.rb:924:infind_every’
/vendor/rails/activerecord/lib/active_record/base.rb:918:in
find_initial' /vendor/rails/activerecord/lib/active_record/base.rb:952:infind_one’
/vendor/rails/activerecord/lib/active_record/base.rb:941:in
find_from_ids' /vendor/rails/activerecord/lib/active_record/base.rb:382:infind’
/lib/item_aids.rb:6:in get_item' /app/controllers/items_controller.rb:277:inversion’
/vendor/rails/actionpack/lib/action_controller/base.rb:908:in
send' /vendor/rails/actionpack/lib/action_controller/base.rb:908:inperform_action_without_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:355:in
`perform_action_without_benchmark’

/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue’

/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in
`measure’

/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' /vendor/rails/actionpack/lib/action_controller/rescue.rb:82:inperform_action’
/vendor/rails/actionpack/lib/action_controller/base.rb:379:in
send' /vendor/rails/actionpack/lib/action_controller/base.rb:379:inprocess_without_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:364:in
`process_without_session_management_support’

/vendor/rails/actionpack/lib/action_controller/session_management.rb:117:in
process' /vendor/rails/railties/lib/dispatcher.rb:38:indispatch’
/vendor/rails/railties/lib/webrick_server.rb:115:in
handle_dispatch' /vendor/rails/railties/lib/webrick_server.rb:81:inservice’
D:/programming/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in
service' D:/programming/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
D:/programming/ruby/lib/ruby/1.8/webrick/server.rb:155:in
start_thread' D:/programming/ruby/lib/ruby/1.8/webrick/server.rb:144:instart’
D:/programming/ruby/lib/ruby/1.8/webrick/server.rb:144:in
start_thread' D:/programming/ruby/lib/ruby/1.8/webrick/server.rb:94:instart’
D:/programming/ruby/lib/ruby/1.8/webrick/server.rb:89:in each' D:/programming/ruby/lib/ruby/1.8/webrick/server.rb:89:instart’
D:/programming/ruby/lib/ruby/1.8/webrick/server.rb:79:in start' D:/programming/ruby/lib/ruby/1.8/webrick/server.rb:79:instart’
/vendor/rails/railties/lib/webrick_server.rb:67:in `dispatch’
/vendor/rails/railties/lib/commands/servers/webrick.rb:59

D:/programming/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require__’

D:/programming/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require’

/vendor/rails/activesupport/lib/active_support/dependencies.rb:136:in
`require’
/vendor/rails/railties/lib/commands/server.rb:30

D:/programming/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require__’

D:/programming/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require’
script/server:7