Rails 8.1 compatibility

#434 · closed · 3 comments

View on GitHub ↗

t27duck

If nothing else, this could be used as catch-all issue for Rails 8.1 compatibility. I cloned and edited the gemspec to allow for active record 8.1 and tried to run it against a basic app. As a starting point, here's the immediate blocker. Stack trace below (this is from attempting to run `bin/jobs`, but this is triggered whenever the database is accessed the first time): ``` /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/column.rb:25:in 'ActiveRecord::ConnectionAdapters::Column#initialize': undefined method 'mutable?' for nil (NoMethodError) @default = default.nil? || cast_type.mutable? ? default : cast_type.deserialize(default) ^^^^^^^^^ from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/postgresql/column.rb:10:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::Column#initialize' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/bundler/gems/activerecord-postgis-adapter-c49d5ed3bb5c/lib/active_record/connection_adapters/postgis/spatial_column.rb:33:in 'ActiveRecord::ConnectionAdapters::PostGIS::SpatialColumn#initialize' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/deduplicable.rb:14:in 'Class#new' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/deduplicable.rb:14:in 'ActiveRecord::ConnectionAdapters::Deduplicable::ClassMethods#new' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/bundler/gems/activerecord-postgis-adapter-c49d5ed3bb5c/lib/active_record/connection_adapters/postgis/schema_statements.rb:28:in 'ActiveRecord::ConnectionAdapters::PostGIS::SchemaStatements#new_column_from_field' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/abstract/schema_statements.rb:112:in 'block in ActiveRecord::ConnectionAdapters::SchemaStatements#columns' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/abstract/schema_statements.rb:111:in 'Array#map' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/abstract/schema_statements.rb:111:in 'ActiveRecord::ConnectionAdapters::SchemaStatements#columns' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/schema_cache.rb:345:in 'block (2 levels) in ActiveRecord::ConnectionAdapters::SchemaCache#columns' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/abstract/connection_pool.rb:449:in 'ActiveRecord::ConnectionAdapters::ConnectionPool#with_connection' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/schema_cache.rb:344:in 'block in ActiveRecord::ConnectionAdapters::SchemaCache#columns' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/schema_cache.rb:343:in 'Hash#fetch' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/schema_cache.rb:343:in 'ActiveRecord::ConnectionAdapters::SchemaCache#columns' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/schema_cache.rb:354:in 'block in ActiveRecord::ConnectionAdapters::SchemaCache#columns_hash' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/schema_cache.rb:353:in 'Hash#fetch' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/schema_cache.rb:353:in 'ActiveRecord::ConnectionAdapters::SchemaCache#columns_hash' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/schema_cache.rb:54:in 'ActiveRecord::ConnectionAdapters::SchemaReflection#columns_hash' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/schema_cache.rb:198:in 'ActiveRecord::ConnectionAdapters::BoundSchemaReflection#columns_hash' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/model_schema.rb:594:in 'ActiveRecord::ModelSchema::ClassMethods#load_schema!' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/counter_cache.rb:212:in 'ActiveRecord::CounterCache::ClassMethods#load_schema!' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/encryption/encryptable_record.rb:127:in 'ActiveRecord::Encryption::EncryptableRecord::ClassMethods#load_schema!' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/model_schema.rb:541:in 'block in ActiveRecord::ModelSchema::ClassMethods#load_schema' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/model_schema.rb:538:in 'Monitor#synchronize' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/model_schema.rb:538:in 'ActiveRecord::ModelSchema::ClassMethods#load_schema' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/model_schema.rb:430:in 'ActiveRecord::ModelSchema::ClassMethods#columns_hash' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/attributes.rb:257:in 'block in ActiveRecord::Attributes::ClassMethods#_default_attributes' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_adapters/abstract/connection_pool.rb:455:in 'ActiveRecord::ConnectionAdapters::ConnectionPool#with_connection' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/connection_handling.rb:310:in 'ActiveRecord::ConnectionHandling#with_connection' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/attributes.rb:256:in 'ActiveRecord::Attributes::ClassMethods#_default_attributes' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activemodel-8.1.0.beta1/lib/active_model/attribute_registration.rb:38:in 'ActiveModel::AttributeRegistration::ClassMethods#attribute_types' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/attribute_methods.rb:261:in 'ActiveRecord::AttributeMethods::ClassMethods#_has_attribute?' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/inheritance.rb:61:in 'ActiveRecord::Inheritance::ClassMethods#new' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0.beta1/lib/active_record/persistence.rb:54:in 'ActiveRecord::Persistence::ClassMethods#create!' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_queue-1.2.1/app/models/solid_queue/process.rb:13:in 'block in SolidQueue::Process.register' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activesupport-8.1.0.beta1/lib/active_support/notifications.rb:210:in 'block in ActiveSupport::Notifications.instrument' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activesupport-8.1.0.beta1/lib/active_support/notifications/instrumenter.rb:58:in 'ActiveSupport::Notifications::Instrumenter#instrument' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activesupport-8.1.0.beta1/lib/active_support/notifications.rb:210:in 'ActiveSupport::Notifications.instrument' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_queue-1.2.1/lib/solid_queue.rb:73:in 'SolidQueue#instrument' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_queue-1.2.1/app/models/solid_queue/process.rb:12:in 'SolidQueue::Process.register' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_queue-1.2.1/lib/solid_queue/processes/registrable.rb:21:in 'SolidQueue::Processes::Registrable#register' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activesupport-8.1.0.beta1/lib/active_support/callbacks.rb:361:in 'block in ActiveSupport::Callbacks::CallTemplate::MethodCall#make_lambda' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activesupport-8.1.0.beta1/lib/active_support/callbacks.rb:207:in 'ActiveSupport::Callbacks::Filters::After#call' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activesupport-8.1.0.beta1/lib/active_support/callbacks.rb:563:in 'block in ActiveSupport::Callbacks::CallbackSequence#invoke_after' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activesupport-8.1.0.beta1/lib/active_support/callbacks.rb:563:in 'Array#each' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activesupport-8.1.0.beta1/lib/active_support/callbacks.rb:563:in 'ActiveSupport::Callbacks::CallbackSequence#invoke_after' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activesupport-8.1.0.beta1/lib/active_support/callbacks.rb:110:in 'ActiveSupport::Callbacks#run_callbacks' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_queue-1.2.1/lib/solid_queue/supervisor.rb:51:in 'block in SolidQueue::Supervisor#boot' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activesupport-8.1.0.beta1/lib/active_support/notifications.rb:210:in 'block in ActiveSupport::Notifications.instrument' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activesupport-8.1.0.beta1/lib/active_support/notifications/instrumenter.rb:58:in 'ActiveSupport::Notifications::Instrumenter#instrument' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activesupport-8.1.0.beta1/lib/active_support/notifications.rb:210:in 'ActiveSupport::Notifications.instrument' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_queue-1.2.1/lib/solid_queue.rb:73:in 'SolidQueue#instrument' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_queue-1.2.1/lib/solid_queue/supervisor.rb:50:in 'SolidQueue::Supervisor#boot' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_queue-1.2.1/lib/solid_queue/supervisor.rb:32:in 'SolidQueue::Supervisor#start' from <internal:kernel>:91:in 'Kernel#tap' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_queue-1.2.1/lib/solid_queue/supervisor.rb:16:in 'SolidQueue::Supervisor.start' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_queue-1.2.1/lib/solid_queue/cli.rb:27:in 'SolidQueue::Cli#start' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/thor-1.4.0/lib/thor/command.rb:28:in 'Thor::Command#run' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/thor-1.4.0/lib/thor/invocation.rb:127:in 'Thor::Invocation#invoke_command' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/thor-1.4.0/lib/thor.rb:538:in 'Thor.dispatch' from /home/vscode/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/thor-1.4.0/lib/thor/base.rb:584:in 'Thor::Base::ClassMethods#start' from bin/jobs:6:in '<main>' ``` After doing some _very_ limited splunking, it looks like the internals of the active record adaptors have changed where `ActiveRecord::ConnectionAdapters::Column` now expects a `cast_type` as the second argument in `initialize`.

Comments

chankruze

Is there any progress ?

gjtorikian

I haven't tried it myself but based on https://github.com/rgeo/activerecord-postgis-adapter/pull/435, https://github.com/seuros/activerecord-postgis seems to be the path forward here?

t27duck

Pointing your Gemfile to the fork/branch in #435 + pointing to the `main` branch in https://github.com/rgeo/rgeo-activerecord _should_ be enough to at least get you going for now.