JackDanger / permanent_records

Rails Plugin - soft-delete your ActiveRecord records. It's like an explicit version of ActsAsParanoid
https://jdanger.com
MIT License
272 stars 64 forks source link

NameError: uninitialized constant Action #79

Open wncappletech opened 8 years ago

wncappletech commented 8 years ago

Receiving an error when trying to call the delete method on an item.

Here is the definition in the controller

def destroy
  @employee = Employee.find(params[:id])
  @employee.destroy
  respond_with @employee, location: employees_url
end

Any help or suggestions would be great. Thank.

drakmail commented 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?

wncappletech commented 8 years ago

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:inblock 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:ininject'\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:inconstantize'\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:ineach'\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:inblock 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:incall'\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:incall'\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:inrun_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:inrun_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:inblock 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:intransaction'\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:inwith_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:inhandle_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:ininstance_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:incall'\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:incall'\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:ineach'\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:inrun_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:inrun_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:inblock 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:inblock 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:intransaction'\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:inwith_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:indestroy'\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:inprocess_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:inblock 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:incall'\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:incall'\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:inrun_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:inrun_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:inprocess_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:inblock 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:ininstrument'\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:inprocess_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:inprocess'\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:indispatch'\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:inblock 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:indispatch'\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:inserve'\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:ineach'\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:incall'\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:inpublic_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:inserve'\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:ineach'\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:incall'\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:inblock 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:incall'\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:incall'\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:incall'\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:incontext'\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:incall'\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:incall'\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:inrun_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:inrun_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:incall'\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:incall'\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:inblock 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:intagged'\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:incall'\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:incall'\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:incall'\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:incall'\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:inpublic_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:inprocess_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:inmain_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:inblock in create_thread_and_abort_on_exception'"

drakmail commented 8 years ago

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 😢

wncappletech commented 8 years ago

That one at least gave me a new error

Exception:

<NoMethodError: undefined method `colleague' for #>

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:indestroy'\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:inprocess_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:inblock 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:incall'\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:incall'\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:inrun_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:inrun_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:inprocess_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:inblock 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:ininstrument'\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:inprocess_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:inprocess'\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:indispatch'\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:inblock 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:indispatch'\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:inserve'\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:ineach'\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:incall'\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:inpublic_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:inserve'\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:ineach'\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:incall'\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:inblock 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:incall'\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:incall'\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:incall'\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:incontext'\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:incall'\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:incall'\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:inrun_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:inrun_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:incall'\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:incall'\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:inblock 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:intagged'\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:incall'\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:incall'\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:incall'\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:incall'\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:inpublic_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:inprocess_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:inmain_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:inblock in create_thread_and_abort_on_exception'"

drakmail commented 8 years ago

Hm, could you attach an screenshot of backtrace and/or provide a 59 line of app/controllers/hccms/employees_controller.rb file?

wncappletech commented 8 years ago

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?

drakmail commented 8 years ago

Interesting, could you also provide an associations (belongs_to) of Employee model?

wncappletech commented 8 years ago

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

drakmail commented 8 years ago

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)

wncappletech commented 8 years ago

that breaks most of my views across the site

drakmail commented 8 years ago

Yeah, sure, but could you check, does same exception throwing after it? Seems that problem could be in the association with foreign_key property.

wncappletech commented 8 years ago

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:inmethod_missing'

drakmail commented 8 years ago

Does you remove @employee.photo.try(:destroy) line from the controller?

wncappletech commented 8 years ago

yes I did

drakmail commented 8 years ago

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')

wncappletech commented 8 years ago

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

drakmail commented 8 years ago

Sorry, not from attribute_methods.rb, just from backtrace :-)

wncappletech commented 8 years ago

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:inmethod_missing'

drakmail commented 8 years ago

Awesome, this stack trace is much more readable! Does you see any lines after NameError: undefined local variable or method...?

wncappletech commented 8 years ago

Nope, that is the entire output from start to finish

drakmail commented 8 years ago

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! :-)

wncappletech commented 8 years ago

Sounds Great! Thank you for your time. I will look forward to hearing from you tomorrow.

drakmail commented 8 years ago

@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?

wncappletech commented 8 years ago

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.

wncappletech commented 8 years ago

Any progress on this issue?