Skip to content

Update for rails 8.1 support#9

Open
xathras wants to merge 2 commits into
rails-8-supportfrom
rails-8-1-support
Open

Update for rails 8.1 support#9
xathras wants to merge 2 commits into
rails-8-supportfrom
rails-8-1-support

Conversation

@xathras
Copy link
Copy Markdown

@xathras xathras commented Apr 20, 2026

This updates our fork of the gem to support rails 8.1 and mysql 8.0.

  • Update the spatial type for an API change to ActiveRecord 8.1
  • Update the spatial column in the adapter for ActiveRecord 8.1 API
    changes
  • Update the schema statements in the adapter for ActiveRecord 8.1 API
    changes
  • Bump the version due to ActiveRecord breaking API changes

This updates our fork of the gem to support rails 8.1 and mysql 8.0.

- Update the spatial type for an API change to ActiveRecord 8.1
- Update the spatial column in the adapter for ActiveRecord 8.1 API
  changes
- Update the schema statements in the adapter for ActiveRecord 8.1 API
  changes
- Bump the version due to ActiveRecord breaking API changes

SpatialColumn.new(
field["Field"],
lookup_cast_type(type_metadata.sql_type),
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API change in ActiveRecord 8.1

geo_type: @geo_type,
sql_type: @sql_type,
srid: @srid
def spatial_factory(srid = @srid)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ActiveRecord 8.1 adds memoization for the various types so we can't use an instance variable anymore.

if ["\x00", "\x01"].include?(marker)
@srid = string[0, 4].unpack1(marker == "\x01" ? "V" : "N")
RGeo::WKRep::WKBParser.new(spatial_factory, support_ewkb: true, default_srid: @srid).parse(string[4..-1])
srid = string[0, 4].unpack1(marker == "\x01" ? "V" : "N")
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to added memoization of types in AR 8.1 we have to stop using an instance variable.

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