"title"=>"Retry known idempotent SELECT queries, New Active Record configuration option, and more!",
"summary"=>"Greetings! I’m Emmanuel Hayford, here to bring you your weekly instalment of “This Week In Rails”. Let’s dive straight into it. Two new guides are now open for community review. If you are well versed in Action View, partials, and helpers, please review and submit your feedback here:",
"content"=>"
Greetings! I’m Emmanuel Hayford, here to bring you your weekly instalment of “This Week In Rails”. Let’s dive straight into it.\n \nTwo new guides are now open for community review. If you are well versed in Action View, partials, and helpers, please review and submit your feedback here:
\n\n\n\nAdd config.active_record.permanent_connection_checkout setting\nThis setting determines the action taken when ActiveRecord::Base.connection is accessed: whether it raises an error, emits a deprecation warning, or does nothing.
\n\nActiveRecord::Base.connection acquires a database connection from the pool and maintains it until the request or job concludes. However, this behaviour may prove undesirable in environments with more threads or fibers than available connections.
\n\nThis configuration facilitates the identification and elimination of code utilising ActiveRecord::Base.connection, encouraging migration to ActiveRecord::Base.with_connection instead. The default behaviour remains unaltered.
\n\nMake ActiveSupport::BacktraceCleaner copy filters on dup\nEnhance ActiveSupport::BacktraceCleaner to replicate filters and silencers during duplication and cloning.
\n\nPreviously, duplication still resulted in shared internal silencers and filters arrays, leading to state leakage.
\n\nEnsure necessary options are added to association options
\n\nNoting the typo in :through, take the following code sample as an example:
\n\nclass User < ApplicationRecord\n has_many :courses\n has_many :assignments, trough: :courses\nend\n
You’d get a misleading error along the lines of
\n\n“Unknown key: :trough. Valid keys are: :class_name, :anonymous_class, :primary_key, …, :index_errors (ArgumentError)”,
\n\nwith this pull request, you’ll now get a clearer message, more like:
\n\n“Unknown key: :trough. Valid keys are: :class_name, :anonymous_class, :primary_key, …, :index_errors, :through (ArgumentError)”.
\n\nNote that in the second error message :through is included in the list of valid options.
\n\nRetry known idempotent SELECT queries on connection-related exceptions\nImplements a mechanism to automatically retry SELECT queries that are known to be idempotent in the event of connection-related exceptions.
\n\nQueries constructed through Arel tree traversal or based on known model attributes are inherently idempotent and can be safely retried upon encountering a connection error. Previously, certain adapters like TrilogyAdapter would raise ActiveRecord::ConnectionFailed: Trilogy::EOFError when faced with a connection error during a request.
\n\nWe had 22 contributors to the Rails codebase this past week!
\n\nTake care.
\n\nYour weekly inside scoop of interesting commits, pull requests and more from Rails.
\n\nSubscribe to get these updates mailed to you.
","author"=>"Emmanuel Hayford",
"link"=>"https://rubyonrails.org/2024/3/29/this-week-in-rails-retry-known-idempotent-select-queries-new-active-record-configuration-option-and-more-b3dfc401",
"published_date"=>Fri, 29 Mar 2024 00:00:00.000000000 UTC +00:00,
"image_url"=>nil,
"feed_url"=>"https://rubyonrails.org/2024/3/29/this-week-in-rails-retry-known-idempotent-select-queries-new-active-record-configuration-option-and-more-b3dfc401",
"language"=>nil,
"active"=>true,
"ricc_source"=>"feedjira::v1",
"created_at"=>Wed, 03 Apr 2024 14:31:21.812745000 UTC +00:00,
"updated_at"=>Tue, 14 May 2024 04:41:58.822970000 UTC +00:00,
"newspaper"=>"Ruby on Rails",
"macro_region"=>"Technology"}