Fix quote method to use database adapter for MySQL compatibility#15
Merged
takaokouji merged 6 commits intomasterfrom Jan 21, 2026
Merged
Fix quote method to use database adapter for MySQL compatibility#15takaokouji merged 6 commits intomasterfrom
takaokouji merged 6 commits intomasterfrom
Conversation
The quote method was hardcoding double quotes (") which only works for
PostgreSQL/SQLite. MySQL requires backticks (`). This change delegates
to the Rails connection adapter's quote_column_name method to use the
correct quoting style for each database.
Changes:
- Fix quote() to use _model_class.connection.quote_column_name()
- Add unit tests for quote method with mock MySQL adapter
- Add MySQL and PostgreSQL services to docker-compose for testing
- Add mysql2 gem to Gemfile
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add `resource` and `resources` methods to ResourceSetOperationResult and ResourcesSetOperationResult for backward compatibility with 0.9.x API. In 0.9.x, operation results had a `resource` accessor. In 0.10+, resources are accessed via `resource_set`. These new methods allow existing code that uses `result.resource` to continue working without modification. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Extract common resource/resources methods into ResourceSetResultMethods module - Use iterator pattern with each_resource for efficiency - Include module in ResourceSetOperationResult and ResourcesSetOperationResult Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The find_by_key signature tests were not needed based on the actual patch requirements. Keep only the resource/resources method tests for ResourceSetOperationResult backward compatibility. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
In 0.9.x, apply_filters was a public method that could be called from outside the resource class. In the current version, it was moved to the protected section. This change restores public accessibility. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
In 0.10+, find_fragments uses ActiveRecord-specific methods (records.pluck) which fails for PORO (Plain Old Ruby Object) models. This change adds automatic detection of non-ActiveRecord models and falls back to a find_by_key-based implementation. Detection: _model_class.respond_to?(:all) Fallback: find_fragments_for_non_active_record uses find_by_key This eliminates the need for PORO resources to override find_fragments, maintaining 0.9.x compatibility where create/find_by_key worked without the subsequent re-fetch via find_fragments. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
quote()method to use_model_class.connection.quote_column_name()instead of hardcoded double quotesTest plan
Docker commands for testing
🤖 Generated with Claude Code