Open wncappletech opened 8 years ago
Could you provide full stack trace?
Maybe this is related to https://github.com/JackDanger/permanent_records/issues/66 ?
Also could you provide database schema for Employee
model?
Here is the schema for Employees
create_table "employees", force: :cascade do |t|
t.integer "ckfinder_file_id"
t.integer "colleague_id"
t.string "email", limit: 255, null: false
t.string "last_name", limit: 255
t.string "first_name", limit: 255
t.string "preferred_name", limit: 255
t.string "middle_name", limit: 255
t.json "settings", default: {"preferred_instead_of_first_name"=>false}
t.datetime "deleted_at"
t.datetime "created_at"
t.datetime "updated_at"
t.string "prefix", limit: 255
t.string "suffix", limit: 255
t.integer "instructor_id"
end
and here is the stack trace
Backtrace:
"/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:261:in const_get'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:261:in
block in constantize'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:259:in each'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:259:in
inject'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:259:in constantize'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/core_ext/string/inflections.rb:66:in
constantize'\n/usr/local/rvm/gems/ruby-2.2.2/gems/permanent_records-4.1.6/lib/permanent_records.rb:110:in block in each_counter_cache'\n/usr/local/rvm/gems/ruby-2.2.2/gems/permanent_records-4.1.6/lib/permanent_records.rb:109:in
each'\n/usr/local/rvm/gems/ruby-2.2.2/gems/permanent_records-4.1.6/lib/permanent_records.rb:109:in each_counter_cache'\n/usr/local/rvm/gems/ruby-2.2.2/gems/permanent_records-4.1.6/lib/permanent_records.rb:125:in
block in destroy_with_permanent_records'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:555:in block (2 levels) in compile'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in
run_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in _run_destroy_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in
run_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/permanent_records-4.1.6/lib/permanent_records.rb:119:in destroy_with_permanent_records'\n/usr/local/rvm/gems/ruby-2.2.2/gems/permanent_records-4.1.6/lib/permanent_records.rb:54:in
block in destroy'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/transactions.rb:351:in block in with_transaction_returning_status'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in
transaction'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in transaction'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/transactions.rb:348:in
with_transaction_returning_status'\n/usr/local/rvm/gems/ruby-2.2.2/gems/permanent_records-4.1.6/lib/permanent_records.rb:50:in destroy'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/associations/belongs_to_association.rb:7:in
handle_dependency'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/associations/builder/belongs_to.rb:113:in block in add_destroy_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:448:in
instance_exec'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:448:in block in make_lambda'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:228:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:228:in block in halting_and_conditional'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:506:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:506:in block in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:506:in
each'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:506:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in
run_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in _run_destroy_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in
run_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/permanent_records-4.1.6/lib/permanent_records.rb:119:in destroy_with_permanent_records'\n/usr/local/rvm/gems/ruby-2.2.2/gems/permanent_records-4.1.6/lib/permanent_records.rb:54:in
block in destroy'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/transactions.rb:351:in block in with_transaction_returning_status'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in
block in transaction'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:184:in within_new_transaction'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in
transaction'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in transaction'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/transactions.rb:348:in
with_transaction_returning_status'\n/usr/local/rvm/gems/ruby-2.2.2/gems/permanent_records-4.1.6/lib/permanent_records.rb:50:in destroy'\n/var/www/haywood.edu/releases/20160615202636/vendor/gems/hccms/app/controllers/hccms/employees_controller.rb:59:in
destroy'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal/implicit_render.rb:4:in send_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:198:in
process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal/rendering.rb:10:in process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:20:in
block in process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:555:in block (2 levels) in compile'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in
run_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in _run_process_action_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in
run_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:19:in process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal/rescue.rb:29:in
process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal/instrumentation.rb:32:in block in process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in
block in instrument'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in instrument'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in
instrument'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal/instrumentation.rb:30:in process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal/params_wrapper.rb:250:in
process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/railties/controller_runtime.rb:18:in process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:137:in
process'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionview-4.2.6/lib/action_view/rendering.rb:30:in process'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal.rb:196:in
dispatch'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal/rack_delegation.rb:13:in dispatch'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal.rb:237:in
block in action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:74:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:74:in
dispatch'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:43:in serve'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/routing/mapper.rb:49:in
serve'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:43:in block in serve'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:30:in
each'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:30:in serve'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:817:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/engine.rb:518:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/railtie.rb:194:in
public_send'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/railtie.rb:194:in method_missing'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/routing/mapper.rb:51:in
serve'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:43:in block in serve'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:30:in
each'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:30:in serve'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:817:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/exception_notification-4.1.4/lib/exception_notification/rack.rb:32:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/warden-1.2.6/lib/warden/manager.rb:35:in
block in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/warden-1.2.6/lib/warden/manager.rb:34:in catch'\n/usr/local/rvm/gems/ruby-2.2.2/gems/warden-1.2.6/lib/warden/manager.rb:34:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/etag.rb:24:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/conditionalget.rb:38:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/head.rb:13:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/params_parser.rb:27:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/flash.rb:260:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:in
context'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/cookies.rb:560:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/query_cache.rb:36:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/callbacks.rb:29:in block in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:88:in
run_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in _run_call_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in
run_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/callbacks.rb:27:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/remote_ip.rb:78:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:17:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/show_exceptions.rb:30:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/rack/logger.rb:38:in call_app'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/rack/logger.rb:20:in
block in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in block in tagged'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:26:in
tagged'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in tagged'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/rack/logger.rb:20:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/request_id.rb:21:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/runtime.rb:18:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/ssl.rb:24:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/engine.rb:518:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/application.rb:165:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/railtie.rb:194:in
public_send'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/railtie.rb:194:in method_missing'\n/usr/local/rvm/gems/ruby-2.2.2/gems/passenger-enterprise-server-5.0.11/lib/phusion_passenger/rack/thread_handler_extension.rb:78:in
process_request'\n/usr/local/rvm/gems/ruby-2.2.2/gems/passenger-enterprise-server-5.0.11/lib/phusion_passenger/request_handler/thread_handler.rb:142:in accept_and_process_next_request'\n/usr/local/rvm/gems/ruby-2.2.2/gems/passenger-enterprise-server-5.0.11/lib/phusion_passenger/request_handler/thread_handler.rb:95:in
main_loop'\n/usr/local/rvm/gems/ruby-2.2.2/gems/passenger-enterprise-server-5.0.11/lib/phusion_passenger/request_handler.rb:439:in block (3 levels) in start_threads'\n/usr/local/rvm/gems/ruby-2.2.2/gems/passenger-enterprise-server-5.0.11/lib/phusion_passenger/utils.rb:95:in
block in create_thread_and_abort_on_exception'"
Hm, could you try temporally change destroy
method to this and try to destroy employee?
def destroy
@employee = Employee.find(params[:id])
@employee.colleague.try(:destroy)
@employee.ckfinder_file.try(:destroy)
@employee.destroy
respond_with @employee, location: employees_url
end
PS. Seems that backtrace is broken 😢
That one at least gave me a new error
Exception:
Here is the backtrace, hopefully this one will be of more help.
Backtrace:
"/usr/local/rvm/gems/ruby-2.2.2/gems/activemodel-4.2.6/lib/active_model/attribute_methods.rb:433:in method_missing'\n/var/www/haywood.edu/releases/20160627190008/vendor/gems/hccms/app/controllers/hccms/employees_controller.rb:59:in
destroy'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal/implicit_render.rb:4:in send_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:198:in
process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal/rendering.rb:10:in process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:20:in
block in process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:555:in block (2 levels) in compile'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in
run_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in _run_process_action_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in
run_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:19:in process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal/rescue.rb:29:in
process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal/instrumentation.rb:32:in block in process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in
block in instrument'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in instrument'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in
instrument'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal/instrumentation.rb:30:in process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal/params_wrapper.rb:250:in
process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/railties/controller_runtime.rb:18:in process_action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:137:in
process'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionview-4.2.6/lib/action_view/rendering.rb:30:in process'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal.rb:196:in
dispatch'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal/rack_delegation.rb:13:in dispatch'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_controller/metal.rb:237:in
block in action'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:74:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:74:in
dispatch'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:43:in serve'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/routing/mapper.rb:49:in
serve'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:43:in block in serve'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:30:in
each'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:30:in serve'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:817:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/engine.rb:518:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/railtie.rb:194:in
public_send'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/railtie.rb:194:in method_missing'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/routing/mapper.rb:51:in
serve'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:43:in block in serve'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:30:in
each'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:30:in serve'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:817:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/exception_notification-4.1.4/lib/exception_notification/rack.rb:32:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/warden-1.2.6/lib/warden/manager.rb:35:in
block in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/warden-1.2.6/lib/warden/manager.rb:34:in catch'\n/usr/local/rvm/gems/ruby-2.2.2/gems/warden-1.2.6/lib/warden/manager.rb:34:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/etag.rb:24:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/conditionalget.rb:38:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/head.rb:13:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/params_parser.rb:27:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/flash.rb:260:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:in
context'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/cookies.rb:560:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/query_cache.rb:36:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/callbacks.rb:29:in block in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:88:in
run_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in _run_call_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in
run_callbacks'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/callbacks.rb:27:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/remote_ip.rb:78:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:17:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/show_exceptions.rb:30:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/rack/logger.rb:38:in call_app'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/rack/logger.rb:20:in
block in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in block in tagged'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:26:in
tagged'\n/usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in tagged'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/rack/logger.rb:20:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/request_id.rb:21:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/runtime.rb:18:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.2.6/lib/action_dispatch/middleware/ssl.rb:24:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/engine.rb:518:in
call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/application.rb:165:in call'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/railtie.rb:194:in
public_send'\n/usr/local/rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/railtie.rb:194:in method_missing'\n/usr/local/rvm/gems/ruby-2.2.2/gems/passenger-enterprise-server-5.0.11/lib/phusion_passenger/rack/thread_handler_extension.rb:78:in
process_request'\n/usr/local/rvm/gems/ruby-2.2.2/gems/passenger-enterprise-server-5.0.11/lib/phusion_passenger/request_handler/thread_handler.rb:142:in accept_and_process_next_request'\n/usr/local/rvm/gems/ruby-2.2.2/gems/passenger-enterprise-server-5.0.11/lib/phusion_passenger/request_handler/thread_handler.rb:95:in
main_loop'\n/usr/local/rvm/gems/ruby-2.2.2/gems/passenger-enterprise-server-5.0.11/lib/phusion_passenger/request_handler.rb:439:in block (3 levels) in start_threads'\n/usr/local/rvm/gems/ruby-2.2.2/gems/passenger-enterprise-server-5.0.11/lib/phusion_passenger/utils.rb:95:in
block in create_thread_and_abort_on_exception'"
Hm, could you attach an screenshot of backtrace and/or provide a 59 line of app/controllers/hccms/employees_controller.rb
file?
line 59 is @employee.colleague.try(:destroy)
from the code you provided.
The backtrace I'm providing is from the error report, is there a better way to get you this information?
Interesting, could you also provide an associations (belongs_to
) of Employee
model?
belongs_to :instructor belongs_to :photo, class_name: 'Ckfinder::File', foreign_key: :ckfinder_file_id, dependent: :destroy
looking at this I made the following changes
def destroy
@employee = Employee.find(params[:id])
@employee.instructor.try(:destroy)
@employee.photo.try(:destroy)
@employee.destroy
respond_with @employee, location: employees_url
end
and still got the original error message of uninitialized constant Action
Could you try to remove belongs_to :photo, class_name: 'Ckfinder::File', foreign_key: :ckfinder_file_id, dependent: :destroy
line from Employee
model? (and also remove @employee.photo.try(:destroy)
line from controller)
that breaks most of my views across the site
Yeah, sure, but could you check, does same exception throwing after it? Seems that problem could be in the association with foreign_key
property.
ran it through the development console and got this
NameError: undefined local variable or method photo' for #<Employee:0x007fb02d9a1cc8> from /usr/local/rvm/gems/ruby-2.2.2/gems/activemodel-4.2.6/lib/active_model/attribute_methods.rb:433:in
method_missing'
Does you remove @employee.photo.try(:destroy)
line from the controller?
yes I did
Could you provide next 2-5 lines from backtrace (NameError: undefined local variable or method photo' for #<Employee:0x007fb02d9a1cc8> from /usr/local/rvm/gems/ruby-2.2.2/gems/activemodel-4.2.6/lib/active_model/attribute_methods.rb:433:inmethod_missing'
)
lines 428 through 435 def method_missing(method, args, &block) if respond_to_without_attributes?(method, true) super else match = match_attribute_method?(method.to_s) match ? attribute_missing(match, args, &block) : super end end
Sorry, not from attribute_methods.rb, just from backtrace :-)
When you say backtrace are you meaning this?
[2] pry(main)> Employee.find(152).destroy
Employee Load (2.7ms) SELECT "employees".* FROM "employees" WHERE "employees"."deleted_at" IS NULL AND "employees"."id" = $1 ORDER BY "employees"."last_name" ASC, "employees"."first_name" ASC LIMIT 1 ["id", 152] BEGIN
EmployeeDegree Load (18.5ms) SELECT "employee_degrees".* FROM "employee_degrees" WHERE "employee_degrees"."employee_id" = $1 [["employee_id", 152]]
SQL (1.5ms) DELETE FROM "employee_degrees" WHERE "employee_degrees"."id" = $1 [["id", 211]]
EmployeeRole Load (2.1ms) SELECT "employee_roles".* FROM "employee_roles" WHERE "employee_roles"."employee_id" = $1 [["employee_id", 152]]
SQL (1.4ms) DELETE FROM "employee_roles" WHERE "employee_roles"."id" = $1 [["id", 327]]
Employee Load (2.0ms) SELECT "employees".* FROM "employees" WHERE "employees"."id" = $1 LIMIT 1 [["id", 152]]
Employee Exists (1.9ms) SELECT 1 AS one FROM "employees" WHERE ("employees"."colleague_id" = 78889 AND "employees"."id" != 152 AND "employees"."deleted_at" = '2016-06-27 20:02:39.695887') LIMIT 1
Employee Exists (1.6ms) SELECT 1 AS one FROM "employees" WHERE ("employees"."email" = 'dreece@haywood.edu' AND "employees"."id" != 152 AND "employees"."deleted_at" = '2016-06-27 20:02:39.695887') LIMIT 1
SQL (5.2ms) UPDATE "employees" SET "deleted_at" = $1, "updated_at" = $2 WHERE "employees"."id" = $3 [["deleted_at", "2016-06-27 20:02:39.695887"], ["updated_at", "2016-06-27 20:02:39.724010"], ["id", 152]]
EmployeeDegree Load (1.5ms) SELECT "employee_degrees".* FROM "employee_degrees" WHERE "employee_degrees"."employee_id" = $1 [["employee_id", 152]]
EmployeeRole Load (1.6ms) SELECT "employee_roles".* FROM "employee_roles" WHERE "employee_roles"."employee_id" = $1 [["employee_id", 152]]
Employee Exists (1.7ms) SELECT 1 AS one FROM "employees" WHERE ("employees"."colleague_id" = 78889 AND "employees"."id" != 152 AND "employees"."deleted_at" = '2016-06-27 20:02:39.695887') LIMIT 1
Employee Exists (1.5ms) SELECT 1 AS one FROM "employees" WHERE ("employees"."email" = 'dreece@haywood.edu' AND "employees"."id" != 152 AND "employees"."deleted_at" = '2016-06-27 20:02:39.695887') LIMIT 1
SQL (1.4ms) UPDATE "employees" SET "deleted_at" = $1, "updated_at" = $2 WHERE "employees"."id" = $3 ["deleted_at", "2016-06-27 20:02:39.695887"], ["updated_at", "2016-06-27 20:02:39.724010"], ["id", 152] ROLLBACK
NameError: undefined local variable or method photo' for #<Employee:0x007fb02d9a1cc8> from /usr/local/rvm/gems/ruby-2.2.2/gems/activemodel-4.2.6/lib/active_model/attribute_methods.rb:433:in
method_missing'
Awesome, this stack trace is much more readable! Does you see any lines after NameError: undefined local variable or method...
?
Nope, that is the entire output from start to finish
Ok, thank you for active participation, seems that I have some ideas what could be wrong, tomorrow I'll try to check some cases which could be source of the problem. So stay tuned! :-)
Sounds Great! Thank you for your time. I will look forward to hearing from you tomorrow.
@wncappletech I'm tried to reproduce your error and seems that it could be specific to you project. Could you try to temporally remove the permanent_records
gem from your project Gemfile
(and also run bundle
after that and restart the rails server) and check does error reproduced?
I was able to test that out in the console and successfully ran destroy on an item. I put permanent_records back and got the original error again.
Any progress on this issue?
Receiving an error when trying to call the delete method on an item.
Here is the definition in the controller
Any help or suggestions would be great. Thank.