bullet_train icon indicating copy to clipboard operation
bullet_train copied to clipboard

Use most recent version of Active Hash

Open gazayas opened this issue 2 years ago • 1 comments

I tried to get the most recent version of Active Hash working until I came across @adampal's issue at https://github.com/active-hash/active_hash/issues/252, so I'm leaving this one be for now unless we really need it.

Bullet Train packages to update

As far as I can tell, these are the packages which need their Gemfiles updated:

  1. bullet_train
  2. bullet_train-base
  3. bullet_train-super_scaffolding
  4. bullet_train-api
  5. bullet_train-roles

Error log

This is the error I'm getting when trying to run unit tests
/home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activerecord-7.0.3.1/lib/active_record/nested_attributes.rb:353:in `block in accepts_nested_attributes_for': No association found for name `current_team'. Has it been defined yet? (ArgumentError)
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activerecord-7.0.3.1/lib/active_record/nested_attributes.rb:340:in `each'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activerecord-7.0.3.1/lib/active_record/nested_attributes.rb:340:in `accepts_nested_attributes_for'
	from /home/gazayas/work/bt/bullet_train-base/app/models/concerns/users/base.rb:24:in `block in <module:Base>'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/concern.rb:136:in `class_eval'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/concern.rb:136:in `append_features'
	from /home/gazayas/work/bt/bullet_train/app/models/user.rb:2:in `include'
	from /home/gazayas/work/bt/bullet_train/app/models/user.rb:2:in `<class:User>'
	from /home/gazayas/work/bt/bullet_train/app/models/user.rb:1:in `<main>'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:27:in `require'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/inflector/methods.rb:280:in `const_get'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/inflector/methods.rb:280:in `constantize'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/core_ext/string/inflections.rb:74:in `constantize'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/devise-4.8.1/lib/devise.rb:320:in `get'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/devise-4.8.1/lib/devise/mapping.rb:83:in `to'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/devise-4.8.1/lib/devise/mapping.rb:78:in `modules'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/devise-4.8.1/lib/devise/mapping.rb:95:in `routes'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/devise-4.8.1/lib/devise/mapping.rb:162:in `default_used_route'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/devise-4.8.1/lib/devise/mapping.rb:72:in `initialize'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/devise-4.8.1/lib/devise.rb:354:in `new'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/devise-4.8.1/lib/devise.rb:354:in `add_mapping'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/devise-4.8.1/lib/devise/rails/routes.rb:243:in `block in devise_for'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/devise-4.8.1/lib/devise/rails/routes.rb:242:in `each'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/devise-4.8.1/lib/devise/rails/routes.rb:242:in `devise_for'
	from /home/gazayas/work/bt/bullet_train/config/routes/devise.rb:1:in `draw'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/routing/mapper.rb:1600:in `instance_eval'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/routing/mapper.rb:1600:in `draw'
	from /home/gazayas/work/bt/bullet_train/config/routes.rb:4:in `block in <main>'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/routing/route_set.rb:428:in `instance_exec'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/routing/route_set.rb:428:in `eval_block'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/routing/route_set.rb:410:in `draw'
	from /home/gazayas/work/bt/bullet_train/config/routes.rb:1:in `<main>'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/application/routes_reloader.rb:50:in `load'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/application/routes_reloader.rb:50:in `block in load_paths'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/application/routes_reloader.rb:50:in `each'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/application/routes_reloader.rb:50:in `load_paths'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/application/routes_reloader.rb:24:in `reload!'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/application/routes_reloader.rb:38:in `block in updater'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/file_update_checker.rb:83:in `execute'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/application/routes_reloader.rb:13:in `execute'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/application/finisher.rb:158:in `block in <module:Finisher>'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/initializable.rb:32:in `instance_exec'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/initializable.rb:32:in `run'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `each'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `call'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/initializable.rb:60:in `run_initializers'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/application.rb:372:in `initialize!'
	from /home/gazayas/work/bt/bullet_train/config/environment.rb:5:in `<main>'
	from /home/gazayas/work/bt/bullet_train/test/test_helper.rb:2:in `require_relative'
	from /home/gazayas/work/bt/bullet_train/test/test_helper.rb:2:in `<main>'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /home/gazayas/work/bt/bullet_train/test/channels/application_cable/connection_test.rb:1:in `<main>'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/test_unit/runner.rb:47:in `block in load_tests'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/test_unit/runner.rb:47:in `each'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/test_unit/runner.rb:47:in `load_tests'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/test_unit/runner.rb:40:in `run'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/commands/test/test_command.rb:33:in `perform'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/command/base.rb:87:in `perform'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/command.rb:48:in `invoke'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3.1/lib/rails/commands.rb:18:in `<main>'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /home/gazayas/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from bin/rails:4:in `<main>'

gazayas avatar Aug 22 '22 07:08 gazayas

@gazayas yep that's a tricky one that we haven't been able to fix in ActiveHash yet. However, it's mainly an issue with the test suite. I've been running that version in production with ActiveRecord 7 for quite a while now and haven't had any issues. If you have any time and want to take a look at the ActiveHash issue, that would be amazing. I've spent some time on it and couldn't find a good solution (or any solution!). Thanks for opening this issue though so we can track it and eventually update the dependency once it's fixed.

adampal avatar Aug 23 '22 06:08 adampal

Looks like this has worked itself out over the last year. The latest version of active_hash is 3.2.0 and that's the version we're currently on. https://github.com/bullet-train-co/bullet_train/blob/main/Gemfile.lock#L49

jagthedrummer avatar Aug 25 '23 18:08 jagthedrummer