2024-03-08
- Greg
(from Ruby on Rails)
Hi, it’s Greg. Let’s explore this week’s changes in the Rails codebase.
Hi, it’s Greg. Let’s explore this week’s changes in the Rails codebase.
Feedback for structuring the Active Record Query Guide
The Active Record Querying Guide is getting restructured and the team working on it requests feedback from the community.
Rails World CFP closes in 2 weeks
2 more weeks left to submit your talk to Rails World 2024!
Railties: configure sanitizer vendor in 7.1 defaults more robustly
In apps where rails-html-sanitizer was not eagerly loaded, the sanitizer default could end up being Rails::HTML4::Sanitizer when it should be set to Rails::HTML5::Sanitizer. This change requires rails-html-sanitizer immediately before it’s needed, and avoids the possibly-incorrect assumption that Rails::HTML::Sanitizer is already defined.
Illustrator .ai files are previewable as PDFs
This happened to work with Marcel 1.0.2 and earlier since magic byte sniffing sees that Illustrator files are PDFs internally, causing these files to be treated as application/pdf despite having a declared content type of application/illustrator and an .ai file extension. Marcel 1.0.3 corrected this to the more specific application/illustrator subtype of application/pdf, but the MuPDF previewer only accepts the parent application/pdf type.
This pull request changes it to accept PDF and any child types allows the previewer to explicitly work with Illustrator files again, which was only a happy accident previously.
Another pull request made illustrator files previewable with Poppler as well
Deprecate ActiveRecord::Base.connection and ConnectionPool#connection
This pull request deprecates ActiveRecord::Base.connection and ActiveRecord::ConnectionAdapters::ConnectionPool#connection in favor of .lease_connection. The method has been renamed as lease_connection to better reflect that the returned connection will be held for the duration of the request or job. ActiveRecord::Base.connection’s deprecation is a soft deprecation, no warnings will be issued and there is no current plan to remove the method.
Add dirties option to Model.uncached
This pull request adds a dirties option to ActiveRecord::Base.uncached and ActiveRecord::ConnectionAdapters::ConnectionPool#uncached. When set to true (the default), writes will clear all query caches belonging to the current thread. When set to false, writes to the affected connection pool will not clear any query cache.
This is needed by Solid Cache so that cache writes do not clear query caches.
You can view the whole list of changes here.
We had 16 contributors to the Rails codebase this past week!
Until next time!
Subscribe to get these updates mailed to you.
[Technology]
🌎 https://rubyonrails.org/2024/3/8/this-week-in-rails
[🧠] [v2] article_embedding_description: {:llm_project_id=>"Unavailable", :llm_dimensions=>nil, :article_size=>4964, :llm_embeddings_model_name=>"textembedding-gecko"}
[🧠] [v1/3] title_embedding_description: {:ricc_notes=>"[embed-v3] Fixed on 9oct24. Only seems incompatible at first glance with embed v1.", :llm_project_id=>"unavailable possibly not using Vertex", :llm_dimensions=>nil, :article_size=>4964, :poly_field=>"title", :llm_embeddings_model_name=>"textembedding-gecko"}
[🧠] [v1/3] summary_embedding_description: {:ricc_notes=>"[embed-v3] Fixed on 9oct24. Only seems incompatible at first glance with embed v1.", :llm_project_id=>"unavailable possibly not using Vertex", :llm_dimensions=>nil, :article_size=>4964, :poly_field=>"summary", :llm_embeddings_model_name=>"textembedding-gecko"}
[🧠] As per bug https://github.com/palladius/gemini-news-crawler/issues/4 we can state this article belongs to titile/summary version: v3 (very few articles updated on 9oct24)
{"id"=>4267,
"title"=>"Illustrator file preview, deprecations and more!",
"summary"=>"Hi, it’s Greg. Let’s explore this week’s changes in the Rails codebase.",
"content"=>"Hi, it’s Greg. Let’s explore this week’s changes in the Rails codebase.
\n\nFeedback for structuring the Active Record Query Guide
\nThe Active Record Querying Guide is getting restructured and the team working on it requests feedback from the community.
\n\nRails World CFP closes in 2 weeks
\n2 more weeks left to submit your talk to Rails World 2024!
\n\nRailties: configure sanitizer vendor in 7.1 defaults more robustly
\nIn apps where rails-html-sanitizer was not eagerly loaded, the sanitizer default could end up being Rails::HTML4::Sanitizer
when it should be set to Rails::HTML5::Sanitizer
. This change require
s rails-html-sanitizer immediately before it’s needed, and avoids the possibly-incorrect assumption that Rails::HTML::Sanitizer
is already defined.
\n\nIllustrator .ai files are previewable as PDFs
\nThis happened to work with Marcel 1.0.2 and earlier since magic byte sniffing sees that Illustrator files are PDFs internally, causing these files to be treated as application/pdf
despite having a declared content type of application/illustrator
and an .ai
file extension. Marcel 1.0.3 corrected this to the more specific application/illustrator
subtype of application/pdf
, but the MuPDF previewer only accepts the parent application/pdf
type.\nThis pull request changes it to accept PDF and any child types allows the previewer to explicitly work with Illustrator files again, which was only a happy accident previously.\nAnother pull request made illustrator files previewable with Poppler as well
\n\nDeprecate ActiveRecord::Base.connection and ConnectionPool#connection
\nThis pull request deprecates ActiveRecord::Base.connection
and ActiveRecord::ConnectionAdapters::ConnectionPool#connection
in favor of .lease_connection
. The method has been renamed as lease_connection
to better reflect that the returned connection will be held for the duration of the request or job. ActiveRecord::Base.connection
’s deprecation is a soft deprecation, no warnings will be issued and there is no current plan to remove the method.
\n\nAdd dirties option to Model.uncached
\nThis pull request adds a dirties
option to ActiveRecord::Base.uncached
and ActiveRecord::ConnectionAdapters::ConnectionPool#uncached
. When set to true
(the default), writes will clear all query caches belonging to the current thread. When set to false
, writes to the affected connection pool will not clear any query cache.\nThis is needed by Solid Cache so that cache writes do not clear query caches.
\n\nYou can view the whole list of changes here.\nWe had 16 contributors to the Rails codebase this past week!
\n\nUntil next time!
\n\nSubscribe to get these updates mailed to you.
",
"author"=>"Greg",
"link"=>"https://rubyonrails.org/2024/3/8/this-week-in-rails",
"published_date"=>Fri, 08 Mar 2024 00:00:00.000000000 UTC +00:00,
"image_url"=>nil,
"feed_url"=>"https://rubyonrails.org/2024/3/8/this-week-in-rails",
"language"=>nil,
"active"=>true,
"ricc_source"=>"feedjira::v1",
"created_at"=>Mon, 01 Apr 2024 20:13:48.998971000 UTC +00:00,
"updated_at"=>Mon, 21 Oct 2024 18:04:01.805564000 UTC +00:00,
"newspaper"=>"Ruby on Rails",
"macro_region"=>"Technology"}