Skip to content

fix: failed to convert active model type to spanner type under certain condition#299

Merged
olavloite merged 3 commits intogoogleapis:mainfrom
ruzia:fix_type_conversion
Feb 19, 2024
Merged

fix: failed to convert active model type to spanner type under certain condition#299
olavloite merged 3 commits intogoogleapis:mainfrom
ruzia:fix_type_conversion

Conversation

@ruzia
Copy link
Contributor

@ruzia ruzia commented Feb 4, 2024

In some cases, such as time related columns, a DelegateClass like ActiveRecord::AttributeMethods::TimeZoneConversion::TimeZoneConverter is passed to the type.

It cause ArgumentError: Cannot determine type for nil values. exception at here.

@ruzia ruzia requested review from a team and olavloite as code owners February 4, 2024 10:28
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/ruby-spanner-activerecord API. label Feb 4, 2024
@conventional-commit-lint-gcf
Copy link

conventional-commit-lint-gcf bot commented Feb 4, 2024

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

…in condition

Added support for the case where a DelegateClass such as ActiveRecord::AttributeMethods::TimeZoneConversion::TimeZoneConverter is passed to type.
@ruzia ruzia force-pushed the fix_type_conversion branch from 5a33596 to 9b89518 Compare February 4, 2024 11:53
@ruzia ruzia changed the title fix: failed to convert active model type to spanner type. under certain condition fix: failed to convert active model type to spanner type under certain condition Feb 4, 2024
@olavloite
Copy link
Collaborator

@ruzia Would you mind adding a test for this, or otherwise add a code sample to this PR that shows how this would normally be used, then I can add a test case for it.

@ruzia
Copy link
Contributor Author

ruzia commented Feb 9, 2024

@olavloite

I have created a simple rails application that causes problems. https://github.com/ruzia/type_conversion_test
When I try to sign up a user using the devise gem, I get "ArgumentError: Cannot determine type for nil values." error.

  1. rewrite config/database.yml to match your environment
  2. Prepare cloud_spanner.json and rails db:migrate
  3. Start rails and open http://0.0.0.0:3000/users/sign_up
  4. You will get an error when you try to register a user.

I am connecting to Cloud Spanner on GCP, not an emulator.

@olavloite olavloite added the automerge Merge the pull request once unit tests and other checks pass. label Feb 19, 2024
@olavloite olavloite merged commit bacb4ef into googleapis:main Feb 19, 2024
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Feb 19, 2024
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