Skip to content
This repository has been archived by the owner on Jun 16, 2020. It is now read-only.

Incompatible with Active Record 5.2? #84

Open
jcavalieri opened this issue Apr 25, 2019 · 6 comments
Open

Incompatible with Active Record 5.2? #84

jcavalieri opened this issue Apr 25, 2019 · 6 comments

Comments

@jcavalieri
Copy link

jcavalieri commented Apr 25, 2019

I'm upgrading from Rails 5.1 to 5.2 with Active Record now at 5.2.3. I'm using bitmask 1.0.

I'm just trying to do a db:create and I get the below error.

It worked before with Rails 5.1. Any ideas if this is a known issue?

root@3f4638b4754a:/app# rake db:create
rake aborted!
NoMethodError: undefined method `bitmask' for User (call 'User.connection' to establish a connection):Class
/usr/local/bundle/gems/activerecord-5.2.3/lib/active_record/dynamic_matchers.rb:22:in `method_missing'
/app/app/models/user.rb:33:in `<class:User>'
/app/app/models/user.rb:24:in `<top (required)>'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:476:in `load'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:476:in `block in load_file'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:661:in `new_constants_in'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:475:in `load_file'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:373:in `block in require_or_load'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:37:in `block in load_interlock'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:13:in `loading'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:37:in `load_interlock'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:356:in `require_or_load'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:510:in `load_missing_constant'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:195:in `const_missing'
/app/app/admin/user.rb:5:in `<top (required)>'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load'
/usr/local/bundle/gems/activeadmin-1.4.3/lib/active_admin/application.rb:130:in `block in load'
/usr/local/bundle/gems/activeadmin-1.4.3/lib/active_admin/error.rb:41:in `capture'
/usr/local/bundle/gems/activeadmin-1.4.3/lib/active_admin/application.rb:130:in `load'
/usr/local/bundle/gems/activeadmin-1.4.3/lib/active_admin/application.rb:122:in `block in load!'
/usr/local/bundle/gems/activeadmin-1.4.3/lib/active_admin/application.rb:122:in `each'
/usr/local/bundle/gems/activeadmin-1.4.3/lib/active_admin/application.rb:122:in `load!'
/usr/local/bundle/gems/activeadmin-1.4.3/lib/active_admin/application.rb:148:in `routes'
/usr/local/bundle/gems/activeadmin-1.4.3/lib/active_admin.rb:77:in `routes'
/app/config/routes.rb:6:in `block in <top (required)>'
/usr/local/bundle/gems/actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:432:in `instance_exec'
/usr/local/bundle/gems/actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:432:in `eval_block'
/usr/local/bundle/gems/actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:414:in `draw'
/app/config/routes.rb:3:in `<top (required)>'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load'
/usr/local/bundle/gems/railties-5.2.3/lib/rails/application/routes_reloader.rb:41:in `block in load_paths'
/usr/local/bundle/gems/railties-5.2.3/lib/rails/application/routes_reloader.rb:41:in `each'
/usr/local/bundle/gems/railties-5.2.3/lib/rails/application/routes_reloader.rb:41:in `load_paths'
/usr/local/bundle/gems/railties-5.2.3/lib/rails/application/routes_reloader.rb:20:in `reload!'
/usr/local/bundle/gems/railties-5.2.3/lib/rails/application.rb:168:in `reload_routes!'
/usr/local/bundle/gems/devise-jwt-0.4.4/lib/devise/jwt/railtie.rb:13:in `block (2 levels) in <class:Railtie>'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:51:in `each'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
/usr/local/bundle/gems/railties-5.2.3/lib/rails/application/finisher.rb:75:in `block in <module:Finisher>'
/usr/local/bundle/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
/usr/local/bundle/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
/usr/local/bundle/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
/usr/local/bundle/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
/usr/local/bundle/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
/app/config/environment.rb:5:in `<top (required)>'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/usr/local/bundle/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/usr/local/bundle/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
/usr/local/bundle/gems/railties-5.2.3/lib/rails/application.rb:520:in `block in run_tasks_blocks'
/usr/local/bundle/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:create => db:load_config => environment
@jcavalieri
Copy link
Author

Clossing.

I got passed this by adding a require to application.rb I'm actually a bit baffled how this worked before.

@jcavalieri
Copy link
Author

Sorry, re-opening. Error was buried.

/usr/local/bundle/gems/activerecord-5.2.3/lib/active_record/model_schema.rb:324:in `table_exists?'
/usr/local/bundle/gems/bitmask_attributes-1.0.0/lib/bitmask_attributes/definition.rb:29:in `validate_for'
/usr/local/bundle/gems/bitmask_attributes-1.0.0/lib/bitmask_attributes/definition.rb:14:in `install_on'
/usr/local/bundle/gems/bitmask_attributes-1.0.0/lib/bitmask_attributes.rb:25:in `bitmask'
/app/app/models/user.rb:33:in `<class:User>'

@jcavalieri jcavalieri reopened this Apr 25, 2019
@jcavalieri
Copy link
Author

My hunch is Active Record has changed the model.table_exists? which is being called here:
https://github.com/joelmoss/bitmask_attributes/blob/master/lib/bitmask_attributes/definition.rb#L29

This is what is throwing the exception.

@jcavalieri
Copy link
Author

I suspect this may have been introduced here:
rails/rails@0007501#diff-08a3e7333b5c1a6b357298070b7b6002

I'll see if I can get a PR together.

@jcavalieri
Copy link
Author

I'm finding the tests difficult to run, since the gem versions aren't locked down.

@jcavalieri
Copy link
Author

Hmmm, just seeing this: #81

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant