From b537f49ba70cee85c71d9d8b5bacc93f4de3024f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Wn=C4=99trzak?= Date: Fri, 16 Aug 2024 10:07:12 +0200 Subject: [PATCH] Add TWIR 16.08.2024 (#336) --- _posts/2024-08-16-this-week-in-rails.markdown | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 _posts/2024-08-16-this-week-in-rails.markdown diff --git a/_posts/2024-08-16-this-week-in-rails.markdown b/_posts/2024-08-16-this-week-in-rails.markdown new file mode 100644 index 00000000..50b35e00 --- /dev/null +++ b/_posts/2024-08-16-this-week-in-rails.markdown @@ -0,0 +1,60 @@ +--- +layout: post +title: "Deferred routes drawing, connect route helper and more" +categories: news +author: Wojtek +og_image: assets/images/this-week-in-rails.png +published: true +date: 2024-08-16 +--- + +Hi, [Wojtek](https://x.com/morgoth85) from this side. Let's explore this week's changes in the Rails codebase. + +[Defer route drawing](https://github.com/rails/rails/pull/52353) +This change triggers the initial reload of routes either through middleware or when a *url_helpers* method is used. +Previously, this was executed unconditionally on boot, which could slow down boot time unnecessarily for larger apps with lots of routes. +Environments like production that have `config.eager_load = true` will continue to eagerly load routes on boot. + +[Add connect route helper](https://github.com/rails/rails/pull/52169) +Defines a route that recognizes HTTP CONNECT (and GET) requests. +More specifically this recognizes HTTP/1 protocol upgrade requests and HTTP/2 CONNECT requests with the protocol pseudo header. + +[Bulk insert fixtures on SQLite](https://github.com/rails/rails/pull/52562) +Previously one insert command was executed for each fixture, now they are aggregated in a single bulk insert command. + +[Update PostgreSQL adapter extensions to include schema name](https://github.com/rails/rails/pull/52313) +The schema dumper will now include the schema name in generated `enable_extension` statements if they differ from the current schema. + +[Add escape_html_entities option to JSON encoder](https://github.com/rails/rails/pull/51272) +This allows for overriding the global configuration found at `ActiveSupport.escape_html_entities_in_json` for specific calls to `to_json`. +This can be used from controllers in the following manner: +```ruby +class MyController < ApplicationController + def index + render json: { hello: "world" }, escape_html_entities: false + end +end +``` + +[Remove racc gem dependency](https://github.com/rails/rails/pull/52610) +`ActionDispatch::Journey::Parser` does not need to be generated by *racc*. This will open the possibility to optimize it in the future. + +[Support minitest 5.25+](https://github.com/rails/rails/pull/52609) +Minitest 5.25 changed the signature of one of the internal methods that was used by Rails. + +[Enable query log tags by default on development env](https://github.com/rails/rails/pull/51342) +This can be used to trace troublesome SQL statements back to the application code that generated these statements. +It is also useful when using multiple databases because the query logs can identify which database is being used. + +[Fix returning type from encrypted attribute](https://github.com/rails/rails/pull/52247) +Previously it always returned *:text* type. + +[Raise when using key which can't respond to #to_sym in encrypted configuration](https://github.com/rails/rails/pull/51950) +As is the case when trying to use an Integer or Float as a key, which is unsupported. + +_You can view the whole list of changes [here](https://github.com/rails/rails/compare/@%7B2024-08-09%7D...main@%7B2024-08-16%7D)._ +_We had [31 contributors](https://contributors.rubyonrails.org/contributors/in-time-window/20240809-20240816) to the Rails codebase this past week!_ + +Until next time! + +_[Subscribe](https://world.hey.com/this.week.in.rails) to get these updates mailed to you._