Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Feb 19, 2024

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 olavloite and a team 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
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 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
32 checks passed
@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.

None yet

2 participants