惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
有赞技术团队
有赞技术团队
量子位
N
Netflix TechBlog - Medium
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
GbyAI
GbyAI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Blog — PlanetScale
Blog — PlanetScale
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
Martin Fowler
Martin Fowler
Y
Y Combinator Blog
宝玉的分享
宝玉的分享
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
V
V2EX
IT之家
IT之家
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

Ruby on Rails: Compress the complexity of modern web apps

Safer to_i coercion, custom to_fs formats, and more! This Week in Rails: May 16, 2026 This Week in Rails: May 8, 2026 This Week in Rails: May 1, 2026 Active Record gets better every week Great big Rails World 2026 update: CFP, Corporate Support tickets, workshops Query command for database queries and more Explicit query: and body: kwargs for integration tests and more! Speedup ActiveRecord::LogSubscriber#sql_color and more! This Week in Rails: March 27, 2026 Rails Versions 8.0.5 and 8.1.3 have been released! Rails Versions 7.2.3.1, 8.0.4.1, and 8.1.2.1 have been released! This Week in Rails: March 20, 2026 Validate URI scheme in Action Text and more This Week in Rails: March 6, 2026 Planning Center is the newest Rails Foundation Contributing member Action Text gets Markdown conversion, editor links in devcontainers, and more! BARRA seeks Rails developer Joe Agliozzo is looking for a Rails developer The rise of lighttpd as the alternative web server When longer is better and more is more Snowdevil: First e-tailer on Rails Natural selection for frameworks in Ruby vs Java Address book tutorial in Portuguese Becoming a better programmer with Rails 10 Things Every Java Programmer Should Know About Ruby Really Getting Started in Rails Off the Treadmill, Onto the Rails Rails 0.9.5: A world of fixes and tweaks Rich clients with Rails and XUL
This Week In Rails - June 9, 2023
David Heinemeier Hansson · 2023-06-09 · via Ruby on Rails: Compress the complexity of modern web apps

Friday, June 9, 2023
Posted by Emmanuel Hayford

Hi! Emmanuel here writing from a train to Katowice! There have been quite a few developments in the Rails codebase over the last few weeks! Let’s take a look at some of them, shall we?

Create a class level #with_routing helper The with_routing helper can now be called at the class level. When called at this level, the routes will be set up before each test and reset after every test. For example:

class RoutingTest < ActionController::TestCase
      with_routing do |routes|
        routes.draw do
          resources :articles
          resources :authors
        end
      end
      def test_articles_route
        assert_routing("/articles", controller: "articles", action: "index")
      end
       def test_authors_route
        assert_routing("/authors", controller: "authors", action: "index")
      end
    end

Allow composite primary key to be derived from schema When launching an application with a schema that incorporates composite primary keys, there will no longer be a warning issued, and the ActiveRecord::Base#primary_key value will not be set to nil anymore.

For instance, consider a table named travel_routes and a corresponding TravelRoute model. In this case, the TravelRoute.primary_key value will be automatically derived as [“origin”, “destination”], as demonstrated in the following example:

create_table :travel_routes, primary_key: [:origin, :destination], force: true do |t|
     t.string :origin
     t.string :destination
   end
   class TravelRoute < ActiveRecord::Base; end

Store connection_pool in database-related exceptions When exceptions are raised from an adapter, it is beneficial to include the connection_pool as it offers additional context. This context includes information about the connection that triggered the exception, as well as details regarding the role and shard involved.

Add engine draw_paths to app By adding the engine’s draw paths to the application route set, the application gains the capability to access and utilize route files defined within engine paths.

Improve quoted parameters in mime types The Mime::Type now offers support for handling types with parameters, ensuring proper handling of quotes. During the parsing of the accept header, the parameters preceding the ‘q’ parameter are retained, and if a matching mime-type is found, it is utilized accordingly. To maintain the existing functionality, a fallback mechanism has been implemented to search for the media-type without the parameters.

Support batching using composite primary keys and multiple column ordering The find_each, find_in_batches, and in_batches methods now offer support for multiple column ordering. When these methods are used on a table with composite primary keys, it is possible to specify ascending or descending order for each individual key. Example:

Person.find_each(order: [:desc, :asc]) do |person|
      person.party_all_night!
    end

That’s it for today. In the past seven days, we had the privilege of witnessing the contributions of 30 amazing individuals to the Rails framework!

Talk to you in the next one!

Your weekly inside scoop of interesting commits, pull requests and more from Rails.

Subscribe to get these updates mailed to you.