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

subclass collection and don't override AR collection #602

Merged
merged 1 commit into from
Aug 13, 2019

Conversation

jtgrenz
Copy link
Contributor

@jtgrenz jtgrenz commented Aug 12, 2019

This PR subclasses the new collection extension introduced in #594 and sets it as the default collection_parser in ShopifyAPI::Base instead of extending ActiveResource directly.

Extending ActiveResource directly can cause problems to apps using active resource to interact with non-shopify APIs and it also caused issues with #600 since ShopifyAPI::Meta uses inherits from ActiveResource::Base and not ShopifyAPI::Base

We had a similar issue with connections in the past and #287 addressed those by subclassing connection. Custom connection classes were added a few years ago and it was deemed necessary to have a fallback to directly extending active resource. I'm not sure we need the same fallback here as custom collection parsers were added I think between 7 and 9 years ago.

@jtgrenz jtgrenz requested a review from garethson August 12, 2019 20:17
@jtgrenz jtgrenz requested a review from a team as a code owner August 12, 2019 20:17
Copy link
Contributor

@garethson garethson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better. I totally missed the fact that we had a collection_parser.

@jtgrenz jtgrenz force-pushed the subclass-collection-ext branch from 6278e67 to 46e1c1a Compare August 12, 2019 20:52
Copy link
Contributor

@tanema tanema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much better, I am not sure why it was monkey patched instead of inherited before. Good work 👍

@jtgrenz jtgrenz force-pushed the subclass-collection-ext branch from 46e1c1a to 4ae2566 Compare August 13, 2019 18:13
@jtgrenz jtgrenz merged commit 31816a6 into master Aug 13, 2019
@jtgrenz jtgrenz deleted the subclass-collection-ext branch August 13, 2019 19:43
@DrewMartin DrewMartin temporarily deployed to rubygems August 29, 2019 22:00 Inactive
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.

4 participants