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

Add support for autoloading nested related objects on ingredients #72

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

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Jul 19, 2023

This takes the capabilities from AlchemyCMS/alchemy_cms#2523 and allows pre-loading object graphs on ingredient's related objects.

Copy link
Member

@tvdeyen tvdeyen left a 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.

app/controllers/alchemy/json_api/pages_controller.rb Outdated Show resolved Hide resolved
app/serializers/alchemy/json_api/page_serializer.rb Outdated Show resolved Hide resolved
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.
Copy link
Member

@tvdeyen tvdeyen left a 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)
Copy link
Member

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
Copy link
Member

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?

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.

2 participants