Skip to content

Add support for autoloading nested related objects on ingredients - #72

Open
mamhoff wants to merge 2 commits into
mainfrom
better-autoloading
Open

Add support for autoloading nested related objects on ingredients#72
mamhoff wants to merge 2 commits into
mainfrom
better-autoloading

Conversation

@mamhoff

@mamhoff mamhoff commented Jul 19, 2023

Copy link
Copy Markdown
Contributor

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

@tvdeyen tvdeyen left a comment

Copy link
Copy Markdown
Member

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.

Comment thread app/controllers/alchemy/json_api/pages_controller.rb Outdated
Comment thread app/serializers/alchemy/json_api/page_serializer.rb Outdated

@tvdeyen tvdeyen left a comment

Copy link
Copy Markdown
Member

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?

Comment thread app/controllers/alchemy/json_api/pages_controller.rb
end

# These overrides have to be in place until
# https://github.com/stas/jsonapi.rb/pull/91

Copy link
Copy Markdown
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?

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.
@tvdeyen
tvdeyen force-pushed the better-autoloading branch from 4a273fb to 8fb2cb2 Compare August 11, 2026 07:54
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