Giter Club home page Giter Club logo

Comments (4)

stevepolitodesign avatar stevepolitodesign commented on June 2, 2024 1

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.

stevepolitodesign avatar stevepolitodesign commented on June 2, 2024 1

@crackofdusk and I are working on this in https://github.com/thoughtbot/suspenders/tree/1119-enable-active-record-strict-loading-by-default

from suspenders.

stevepolitodesign avatar stevepolitodesign commented on June 2, 2024

@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.

MatheusRich avatar MatheusRich commented on June 2, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.