Fix column type discovery running too early - #55
Closed
RDIL wants to merge 3 commits into
Closed
Conversation
In a test environment, or when creating/seeding the database, there are no tables defined in ActiveRecord. This causes an edge case where, if *any* `method_missing` is called (and it gets to MSL), an error will be thrown. This is because accessing `columns_hash` or `column_names` will cause a query to be made that will fail (as it expects the table to already be present in the database). For getting caught up on the memes, see the following: - Genius/Rap-Genius#15200 - Genius/heroku-buildpack-ruby#14 Feel free to backport this to Rails 2 - seems pointless since it's On The Way Out (TM) (as it has been for the last decade, but who's counting?!)
Same memes, different day. It's not a real model, so it shouldn't crash on column type discovery, since it has no columns.
Closed
Member
Author
|
Closing due to fork: https://github.com/RDIL/modern_searchlogic (it's published to RubyGems now) |
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.
In a test environment, or when creating/seeding the database, there are no tables defined in ActiveRecord. This causes an edge case, where, if any
method_missingis called (and it gets to MSL), an error will be thrown. This is because accessingcolumns_hashorcolumn_nameswill cause a query to be made that will fail on the Postgres side (as it expects the table to already be present in the database).For getting caught up on the memes, see the following:
Additionally, I've fixed another case where column type discovery should not run: abstract classes. This is a common pattern in newer rails apps.
Feel free to backport this to Rails 2 - seems pointless since it's On The Way Out (TM) (as it has been for the last decade, but who's counting?!)
Test Plan
Test suite passes on my local branch.
I haven't PR'd in all this work yet, but it allows the tests to run on Ruby 3.