Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix update to AR reflection keys being strings not symbols #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tatecarr
Copy link

@tatecarr tatecarr commented Aug 7, 2016

Versions after rails 4.1.5, the reflections keys became String rather than Symbol. 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 uses Symbol for the local_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 a Symbol and passes the local_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 the Symbol. 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 between Symbol keys and String keys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant