Loading Error on Jets Deploy

When I run jets deploy it throws following error

ruby-2.5.5@jets-gemset/gems/activerecord-5.2.3/lib/active_record/dynamic_matchers.rb:22:in method_missing’: undefined local variable or method has_closure_tree' for Document (call 'Document.connection' to establish a connection):Class (NameError)

For the record, JETS_ENV=production jets console works fine. Document.last works fine.

Background
I have already patched up closure tree gem which was earlier throwing a similar error https://github.com/ClosureTree/closure_tree/compare/master...iamrahulroy:master

After doing that my jets console started working. And I was able to continue with the development.

Stack Trace:

Traceback (most recent call last):
	34: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/bin/ruby_executable_hooks:24:in `<main>'
	33: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/bin/ruby_executable_hooks:24:in `eval'
	32: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/bin/jets:23:in `<main>'
	31: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/bin/jets:23:in `load'
	30: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/exe/jets:14:in `<top (required)>'
	29: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/cli.rb:5:in `start'
	28: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/cli.rb:20:in `start'
	27: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/cli.rb:48:in `boot_jets'
	26: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/core.rb:18:in `boot'
	25: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/booter.rb:24:in `boot!'
	24: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/booter.rb:201:in `eager_load_app'
	23: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/booter.rb:201:in `select'
	22: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/booter.rb:218:in `block in eager_load_app'
	21: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/core_ext/string/inflections.rb:68:in `constantize'
	20: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:281:in `constantize'
	19: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:281:in `inject'
	18: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:281:in `each'
	17: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:283:in `block in constantize'
	16: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:283:in `const_get'
	15: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:195:in `const_missing'
	14: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:510:in `load_missing_constant'
	13: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:356:in `require_or_load'
	12: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:37:in `load_interlock'
	11: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:13:in `loading'
	10: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
	 9: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
	 8: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:37:in `block in load_interlock'
	 7: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:373:in `block in require_or_load'
	 6: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:475:in `load_file'
	 5: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:661:in `new_constants_in'
	 4: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:476:in `block in load_file'
	 3: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:476:in `load'
	 2: from /Users/rahul/instant_systems/dms-projects/dms_backend_api/app/models/document.rb:58:in `<top (required)>'
	 1: from /Users/rahul/instant_systems/dms-projects/dms_backend_api/app/models/document.rb:67:in `<class:Document>'
/Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activerecord-5.2.3/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined local variable or method `has_closure_tree' for Document (call 'Document.connection' to establish a connection):Class (NameError)
Did you mean?  has_secure_token

I commented out has_closure_tree and now it’s throwing a new error:

Traceback (most recent call last):
	23: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/bin/ruby_executable_hooks:24:in `<main>'
	22: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/bin/ruby_executable_hooks:24:in `eval'
	21: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/bin/jets:23:in `<main>'
	20: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/bin/jets:23:in `load'
	19: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/exe/jets:14:in `<top (required)>'
	18: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/cli.rb:5:in `start'
	17: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/cli.rb:20:in `start'
	16: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/cli.rb:48:in `boot_jets'
	15: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/core.rb:18:in `boot'
	14: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/booter.rb:24:in `boot!'
	13: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/booter.rb:201:in `eager_load_app'
	12: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/booter.rb:201:in `select'
	11: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/jets-1.8.9/lib/jets/booter.rb:218:in `block in eager_load_app'
	10: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/core_ext/string/inflections.rb:68:in `constantize'
	 9: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:281:in `constantize'
	 8: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:281:in `inject'
	 7: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:281:in `each'
	 6: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:283:in `block in constantize'
	 5: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:283:in `const_get'
	 4: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:13:in `loading'
	 3: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
	 2: from /Users/rahul/.rvm/gems/ruby-2.5.5@jets-gemset/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
	 1: from /Users/rahul/instant_systems/dms-projects/dms_backend_api/app/serializers/project_serializer.rb:1:in `<top (required)>'
/Users/rahul/instant_systems/dms-projects/dms_backend_api/app/serializers/project_serializer.rb:2:in `<class:ProjectSerializer>': uninitialized constant ProjectSerializer::FastJsonapi (NameError)

Glad you were able to sort it. Here’s a link to the fix for posterity and others: https://github.com/tongueroo/jets/issues/245#issuecomment-491545893