Comments (4)
Interesting! I didn't realize logging was an option.
I'd say the developer could disable it on a model/association basis.
I was thinking the same thing, although, there could be cases in which one would want to lazy-load a query in a specific context?
It looks like you can call strict_loading on a specific query to have the feature enabled. It looks like we could pass false
to that method.
from suspenders.
@crackofdusk and I are working on this in https://github.com/thoughtbot/suspenders/tree/1119-enable-active-record-strict-loading-by-default
from suspenders.
@MatheusRich overall, I like this idea. If I'm understanding this correctly, enabling this feature will result in ActiveRecord::StrictLoadingViolationError being raised anytime an attempt to lazily load records was made.
However, what do we do in the case where we desire lazy loading, as mentioned in your example?
This article mentions a few approaches to enabling/disabling it on a more granular level.
My concern is that a developer my not know where the error is coming from, and decide to simply disable strict_loading_by_default
as a whole.
from suspenders.
@stevepolitodesign In those cases, I'd say the developer could disable it on a model/association basis. That being said, we could enable make it just log errors, instead of raising them
# development.rb:
config.active_record.action_on_strict_loading_violation = :log
from suspenders.
Related Issues (20)
- suspenders my_project - Could not locate Gemfile or .bundle/ directory (Bundler::GemfileNotFound) HOT 3
- Generate `./bin/dev` script HOT 2
- Load normalize.css HOT 5
- Use correct script tags HOT 2
- Simplify asset dependencies HOT 1
- SassC::SyntaxError in Users#index HOT 3
- Remove sprockets HOT 3
- Your Ruby version is 3.1.3, but your Gemfile specified 3.0.5 HOT 5
- Annotate HTML output with template file names by default HOT 3
- Enable simplecov branch coverage
- Use overmind if available HOT 2
- Add email helper methods to spec helper HOT 1
- Issue deploying to Heroku with `standard/rake` HOT 3
- Remove wrap_parameters workaround HOT 1
- Suspenders fails to generate because Redis 4 is wanted, but only 5 is available HOT 1
- Gemfile missing many gems HOT 1
- What is our default CI service? HOT 8
- Generated Dockerfile doesn't work with flightdeck HOT 3
- PostCSS fonts HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from suspenders.