Update for rails 8.1 support#9
Open
xathras wants to merge 2 commits into
Open
Conversation
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
xathras
commented
Apr 20, 2026
|
|
||
| SpatialColumn.new( | ||
| field["Field"], | ||
| lookup_cast_type(type_metadata.sql_type), |
xathras
commented
Apr 20, 2026
| geo_type: @geo_type, | ||
| sql_type: @sql_type, | ||
| srid: @srid | ||
| def spatial_factory(srid = @srid) |
Author
There was a problem hiding this comment.
ActiveRecord 8.1 adds memoization for the various types so we can't use an instance variable anymore.
xathras
commented
Apr 20, 2026
| 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") |
Author
There was a problem hiding this comment.
Due to added memoization of types in AR 8.1 we have to stop using an instance variable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates our fork of the gem to support rails 8.1 and mysql 8.0.
changes
changes