Skip to content

feat: support ActiveRecord 8.1.x #385

Merged
olavloite merged 1 commit intomainfrom
update-all-deps
Feb 9, 2026
Merged

feat: support ActiveRecord 8.1.x #385
olavloite merged 1 commit intomainfrom
update-all-deps

Conversation

@olavloite
Copy link
Collaborator

@olavloite olavloite commented Feb 5, 2026

Adds support for ActiveRecord 8.1.x.

@olavloite olavloite requested a review from a team February 5, 2026 07:47
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/ruby-spanner-activerecord API. label Feb 5, 2026
gemini-code-assist[bot]

This comment was marked as outdated.

@olavloite olavloite force-pushed the update-all-deps branch 4 times, most recently from 4b93f84 to c3bbb75 Compare February 5, 2026 14:42
@olavloite olavloite changed the title deps: update multiple dependencies feat: support ActiveRecord 8.1.x Feb 5, 2026
@olavloite
Copy link
Collaborator Author

/gemini review

@googleapis googleapis deleted a comment from gemini-code-assist bot Feb 5, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for ActiveRecord 8.1.x by updating dependencies and adapting to API changes. My review focuses on improving maintainability by reducing code duplication introduced for version compatibility and fixing a critical bug related to a constant not being available due to load order issues. The changes to support the new ActiveRecord version are otherwise looking good.

e = assert_raises(ArgumentError) {
connection.rename_index(table_name, "old_idx", too_long_index_name)
}
assert_match(/too long; the limit is #{connection.index_name_length} characters/, e.message)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The error message is slightly different in 8.1 than in the other versions. We don't really care about the specific error message, only that it is actually an error message about the index name being too long.

end
else
# rubocop:disable Style/OptionalBooleanParameter
def initialize(name, cast_type, default, sql_type_metadata = nil, null = true,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

8.1 introduced a new positional parameter cast_type for this constructor.

if options.key? :default
sql << " DEFAULT (#{quote_default_expression options[:default], column})"
sql << if respond_to? :quote_default_expression_for_column_definition, :include_private
" DEFAULT (#{quote_default_expression_for_column_definition options[:default], column})"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is related to the same cast_type change above. In 8.1, we need to call quote_default_expression_for_column_definition, which again uses the value of cast_type to generate the correct expression.

@@ -0,0 +1,25 @@
# Copyright 2026 Google LLC
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This has been moved to a separate file, so we can require it from two places. It is now also needed in connection.rb.

Adds support for ActiveRecord 8.1.x.
@olavloite olavloite merged commit d1774f3 into main Feb 9, 2026
52 checks passed
@olavloite olavloite deleted the update-all-deps branch February 9, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the googleapis/ruby-spanner-activerecord API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants