Fix add_column and generator behavior for missing type#49
Open
michaelherold wants to merge 4 commits intomainfrom
Open
Fix add_column and generator behavior for missing type#49michaelherold wants to merge 4 commits intomainfrom
michaelherold wants to merge 4 commits intomainfrom
Conversation
Without this, ActiveRecord does not yet know which type of adapter to use. This makes monkey patching the specific adapter class(es) that you need impossible. This mirrors what we do in the spec helper.
These were typos in the URLs for comparison links between versions. They should now all work correctly.
When using `add_column`, the definition methods for `ksuid` and `ksuid_binary` are not used like when using `table.ksuid` since `add_column` creates the column directly. This change makes it so any column definition can handle both `ksuid` and `ksuid_binary` correctly by monkey-patching the method that creates the column definitions.
53b1b36 to
14e859c
Compare
Owner
Author
|
@DataDaoDe, care to give this a whirl to see if it fixes the issue? |
|
@michaelherold awesome. I'll check it out today. |
|
This fixed the |
This change makes it so `rails generate model example:ksuid` works as expected. I am unsure how fragile this test is. Ideally, we would have a test that runs the generator against a dummy app and asserts on the outcome, but I don't have the spoons to manage that right now.
Owner
Author
|
Rats, I have a fix but it only works for 7.0+. I'd like to still support 6.1 so need to muddle some more. It's almost like monkey-patching Rails is a bad idea! 😅 |
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.
When using
add_column, the definition methods forksuidandksuid_binaryare not used like when usingtable.ksuidsinceadd_columncreates the column directly.This change makes it so any column definition can handle both
ksuidandksuid_binarycorrectly by monkey-patching the method that creates the column definitions.It also makes it so
rails generate model example:ksuidworks as expected. I am unsure how fragile this test is. Ideally, we would have a test that runs the generator against a dummy app and asserts on the outcome, but I don't have the spoons to manage that right now.Closes #48