Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherit from ApplicationRecord when on Rails 7 #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shayonj
Copy link

@shayonj shayonj commented Jun 4, 2024

It appears that bindings have changed when on Rails 7 and inheriting from ActiveRecord::Base results in trying to make connection through the activerecord adapter for File which fails with ActiveRecord::ConnectionNotEstablished. Given ApplicationRecord is suppose to be the new parent class anyways, updating the logic accordingly.

Requiring all gems to prepare for compiling... You don't have dalli installed in your application. Please add it to your Gemfile and run bundle install
bundler: failed to load command: tapioca (/Users/shayon/src/tines/backend/vendor/bundle/ruby/3.3.0/bin/tapioca)
/Users/shayon/src/tines/backend/vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.8.3/lib/active_record/connection_handling.rb:309:in `connection_pool': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
	from /Users/shayon/src/tines/backend/vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.8.3/lib/active_record/connection_handling.rb:305:in `connection_db_config'
	from /Users/shayon/src/tines/backend/vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.8.3/lib/active_record/type.rb:50:in `adapter_name_from'
	from /Users/shayon/src/tines/backend/vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.8.3/lib/active_record/attributes.rb:216:in `attribute'
	from /Users/shayon/src/tines/backend/vendor/bundle/ruby/3.3.0/gems/active_storage-postgresql-0.3.1/lib/active_storage/postgresql/file.rb:4:in `<class:File>'
	from /Users/shayon/src/tines/backend/vendor/bundle/ruby/3.3.0/gems/active_storage-postgresql-0.3.1/lib/active_storage/postgresql/file.rb:1:in `<main>'
	from /Users/shayon/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /Users/shayon/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'

Open to any feedback/suggestions here, thank you

It appears that bindings have changed when on Rails 7 and inheriting from ActiveRecord::Base results in trying to make connection
through the activerecord adapter for File which fails with ActiveRecord::ConnectionNotEstablished. Given ApplicationRecord is suppose
to be the new parent class anyways, updating the logic accordingly.

Open to any feedback/suggestions here, thank you
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant