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

Defer serializer relationships when eager loading #127

Merged
merged 1 commit into from Apr 17, 2019

Conversation

richmolj
Copy link
Contributor

To do endpoint validation, we register a proc in railtie.rb that checks
routes. For this to work, all resources and routes must be loaded. This
is a problem because the resource classes load before routes are
finished, and we want to do this at boot instead of runtime for
performance.

The solution is to defer the link validation until the app has loaded
and we've reloaded routes. This happens in railtie.rb, but it looks
like a straggler line would not defer, only under very specific
scenarios (when eager loading in production with polymorphic resources,
and a particular load order).

I've removed the straggler line to ensure this works as intended.

To do endpoint validation, we register a proc in railtie.rb that checks
routes. For this to work, all resources and routes must be loaded. This
is a problem because the resource classes load before routes are
finished, and we want to do this at boot instead of runtime for
performance.

The solution is to defer the link validation until the app has loaded
*and* we've reloaded routes. This happens in railtie.rb, but it looks
like a straggler line would not defer, only under very specific
scenarios (when eager loading in production with polymorphic resources,
*and* a particular load order).

I've removed the straggler line to ensure this works as intended.
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.

None yet

1 participant