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

strict_loading_by_default ? #285

Open
andyw8 opened this issue Apr 29, 2021 · 1 comment
Open

strict_loading_by_default ? #285

andyw8 opened this issue Apr 29, 2021 · 1 comment

Comments

@andyw8
Copy link
Contributor

andyw8 commented Apr 29, 2021

Just starting for discussion, I haven't dug into this deeply.

Should the styleguide recommend config.active_record.strict_loading_by_default = true ?

https://bigbinary.com/blog/rails-6-1-adds-strict_loading-to-warn-lazy-loading-associations

@koic
Copy link
Member

koic commented Apr 29, 2021

The N+1 query problem can be forcibly prevented, but there is a possibility of false making of unnecessary eager loading instead. So, strict_loading may be fine in most cases, but in some cases it seems that user need to be careful (Handling of queries for performance issues is sensitive). Therefore, I think it's better to leave it up to well-informed application developers to take it or not because it's a case-by-case basis. That being said, strict_loading is a great feature of Rails 6.1 :-)

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

No branches or pull requests

2 participants