-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add support for autoloading nested related objects on ingredients #72
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. I think the specs fail because we now always return public version elements.
This adds a `.preload_relations` object to serializers and leverages that and the Rails preloader service object to preload ActiveRecord object graphs below the related object of ingredients.
See stas/jsonapi.rb#91 for details on what these fix.
aab986e
to
4a273fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @mamhoff still want to work on this?
@@ -109,6 +111,14 @@ def page_scope_with_includes | |||
) | |||
end | |||
|
|||
def preload_ingredients(scope) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We removed essence support. This can probably be removed now.
@@ -129,6 +139,42 @@ def base_page_scope | |||
def jsonapi_serializer_class(_resource, _is_collection) | |||
::Alchemy::JsonApi::PageSerializer | |||
end | |||
|
|||
# These overrides have to be in place until | |||
# https://github.com/stas/jsonapi.rb/pull/91 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this has been merged, can this be removed?
This takes the capabilities from AlchemyCMS/alchemy_cms#2523 and allows pre-loading object graphs on ingredient's related objects.