

Github Opting out of strict loading on a per-record base by ayrton · Pull Reques...
source link: https://github.com/rails/rails/pull/41181
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Would love to hear if we should ship with lazy loaded records, when serialization happens through globalid, to avoid having to write:
record.strict_loading!(false)
in your jobs:
module MyApplication class Application < Rails::Application config.active_record.strict_loading_by_default = true end end class Subscription < ApplicationRecord belongs_to :user end class User < ApplicationRecord has_many :subscriptions, inverse_of: :user end class ArchiveSubscriptionJob < ApplicationJob def perform(subscription) subscription.strict_loading!(false) # <-- should this be done out-of-the-box? user = subscription.user # [...] end end
If so I am happy to draft up the code (either in this PR or a different one). Something along the lines of:
# activejob/lib/active_job/arguments.rb def deserialize_global_id(hash) GlobalID::Locator.locate(hash[GLOBALID_KEY]).tap do |record| record.strict_loading!(false) if record.respond_to?(:strict_loading!) end end
Recommend
-
18
Hi, Wojtek from this side with a summary of the latest changes that will be available in the upcoming Rails 6.1. Ra...
-
10
Unusual solutions involving opting out I've been known to find weird solutions to problems. Sometimes they are driven by my own desire to optimize a situation for my own benefit. Here's one which happened during a particularly b...
-
6
Example loading data from a data base into Flash MX with Flash Remoting and CF MX Monday, April 29, 2002 Below is sample code that shows how to load data from a data base from Flash MX using Flash Remoting and ColdFusion com...
-
23
Ignore strict loading violations on instances loaded through fixtures #40792
-
12
Member eileencodes commented
-
9
15 Apr 2021 guidesOpting your Website out of Google's FLoC NetworkGoogle recently announced the rollout of their Federated Learning of Cohorts (FLoC), a new advertising-surveillance initiative that...
-
6
Things To Consider Before Opting For A Private Cinema Viewing Community Cin...
-
3
New issue Strict loading cascade down to middle records #42494
-
7
Copy link Member Author ghiculescu...
-
6
Birchtree By Matt Birchler I've been writing here since 2010! Back when personal blogs were all the rage. Kids, a...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK