Skip to content

Inherit from ApplicationRecord when on Rails 7#21

Open
shayonj wants to merge 1 commit intolsylvester:mainfrom
shayonj:s/rails-7
Open

Inherit from ApplicationRecord when on Rails 7#21
shayonj wants to merge 1 commit intolsylvester:mainfrom
shayonj:s/rails-7

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
@shayonj
Copy link
Author

shayonj commented May 15, 2025

@lsylvester would love to get your thoughts on this 🙏🏾

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