Fix update to AR reflection keys being strings not symbols #28
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
String
rather 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.name
must return a string).netsuite_rails
usesSymbol
for thelocal_field
so 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
String
or aSymbol
and passes thelocal_field
accordingly.If the reflections hash is empty
{}
then{}.keys.first
is nil, and the class =NilClass
which 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 betweenSymbol
keys andString
keys.