Fix update to AR reflection keys being strings not symbols#28
Open
tatecarr wants to merge 2 commits intoNetSweet:masterfrom
Open
Fix update to AR reflection keys being strings not symbols#28tatecarr wants to merge 2 commits intoNetSweet:masterfrom
tatecarr wants to merge 2 commits intoNetSweet:masterfrom
Conversation
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.
Versions after rails 4.1.5, the reflections keys became
Stringrather thanSymbol. It looks like they alternated between setting the key to a string as the value was set, and making the source of the key return a string (parent_reflection.namemust return a string).netsuite_railsusesSymbolfor thelocal_fieldso this caused an issue when the field had a contructed value rather than a simple one (like a text field in NS).Possibly should alter the way I've fixed this, but it tests to see if the first key of the reflections hash is a
Stringor aSymboland passes thelocal_fieldaccordingly.If the reflections hash is empty
{}then{}.keys.firstis nil, and the class =NilClasswhich is not a string and would then pass theSymbol. Which shouldn't matter since there are no keys to match against anyway. So seems like this would be a solid fix that bridges the gap betweenSymbolkeys andStringkeys.