This Week in Rails

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

ERB in YAML keys, performance boosts, a new option for QueryLogs!

こんにちは。I'm Emmanuel, and I've got some updates for you! Avoid double type cast when serialising attributes ActiveModel::Attribute#value already casts model attributes when persisting models, however some model attribute types try to cast a given value before serialising it. This means casting is done twice in most cases. This PR fixes t...
Read more
September 23, 2022

Improved assert_redirected_to, improved error messages and more!

Hi, this is Greg, bringing you the latest changes in the Rails framework. Allow specifying the HTTP status code in assert_redirected_to Before this change, assert_redirect_to asserted any 3XX response, but with this change, it is possible to assert a specific response code, like 301. Allow passing classes to dom_id Allowing dom_id to r...
Read more
September 17, 2022

Handling reconnects in Action Cable, no more Coffeescript and a new guide.

Hi, this is Petrik with this week's Rails updates and some Hotwire news. Add exclude? method to ActionController::Parameters exclude? returns true if the given key is not present in the parameters. It is the inverse of include?. Adding this method keeps things a little more consistent with a Hash. params = ActionController::Parameters....
Read more
September 10, 2022

Rack 3 and Rails 7.0.4, 6.1.7, and 6.0.6 releases, ActionDispatch::Cookies, etc

👋🏾... This is Emmanuel. I've got some Rails updates for you. Rack 3.0 has shipped A major version of Rack has shipped, and as expected, there are breaking changes but with lots of improvements and an upgrade guide. There's also a changelog of the beta versions and release candidates leading up to the release. Rails 7.0.4, 6.1.7, and 6....
Read more
September 2, 2022

Bugfixes, improvements and more!

Hi, this is Greg with the latest news from the world of Rails. Return "Range Not Satisfiable" return code for partial downloads with incorrect range This PR fixes an issue when a partial download request with an incorrect range was made. Before the fix, Rails threw a RoutingError, but from now on it returns a "Range Not Satisfiable" re...
Read more
August 26, 2022

Finer-grained error pages and extended routes grepping

Hi, this is Petrik with more Rails updates. Use the error_highlight gem to locate the columns where an error was raised Ruby 3.1 added the error_highlight gem to display the fine-grained location of where an error occurred. Rails will now use error_highlight on error pages to show the column range of where an error occurred. Extend bin...
Read more
August 19, 2022

Logging, raising and rescuing errors and a fix for a query method.

Cześć! I'm Emmanuel, and I have some updates for you from Rails. Log a warning if ActiveSupport::Cache is given an expiration in the past Imagine trying to write/fetch to/from a cache and the operation fails silently because `expires_at` is in the past... a debugger's nightmare. This PR helps. You won't get an error raised, instead, yo...
Read more
August 12, 2022

Bugfixes, improvements and more!

Hola, this is Greg bringing you the latest news from the Rails world! Improve failure safety for RedisCacheStore#delete_multi This PR fixes the issue when Redis is down and Rails.cache.delete_multi is called. With this change this will be gracefully handled rather than raising an exception. Ensure drop_enum is always reversible The rec...
Read more
August 5, 2022

Strict template locals, detecting unused routes and an improved find_or_create_by

Hi, Petrik here with some updates on activities in Rails and associated projects over the last week. Allow templates to set strict locals By default, templates will accept any locals as keyword arguments. To define what locals a template accepts, add a locals magic comment: <%# locals: (message:) -%> <%= message %> Try to find a second...
Read more
July 29, 2022

Cache invalidation via ActiveStorage::Blob, Conditionally executing has_secure_password, etc

Maadwo! Emmanuel with some updates on activities in Rails over the last week. Allow passing Hash on secure password validations You can now pass an option hash to has_secure_password. If the option evaluates to true, then has_secure_password executes along with validations, otherwise it doesn't. Touch model records after ActiveStorage:...
Read more
July 22, 2022

Bugfixes, performance improvements and more!

Hi, this is Greg, bringing you the latest news from the Rails world. Fix caching of missed translations Using Object.new for the default value of a missing translation caused the cache store to return a different object when being fetched from the cache. This PR changes the default to an integer, which resolves the problem. Add endless...
Read more
July 15, 2022

Rails security releases, Improved generator option handling and more...

Hi! Emmanuel here with updates from Rails over the last week. Rails Versions 7.0.3.1, 6.1.6.1, 6.0.5.1, and 5.2.8.1 have been released! A few days ago Rails released versions 7.0.3.1, 6.1.6.1, 6.0.5.1, and 5.2.8.1. These are security updates that impact applications that use serialised attributes on Active Record models. These updates,...
Read more
July 4, 2022

Improved PostgreSQL support, performance improvements and more...

Hi, this is Petrik, bringing you the latest news from the Rails world. Optimize Active Record batching Instead of specifying a long list of ids for batch queries (WHERE IN (...ids...)), Active Record will iterate in ranges (WHERE id >= num1 AND id < num2). Add validity for PostgreSQL indexes When creating indexes with CONCURRENTLY, you...
Read more
May 21, 2022

Bugfixes, guides improvement and more!

Hi, this is Greg, bringing you the latest news from the Rails world. Add ability to ignore tables by a regular expression for SQL schema dumps It was already possible to ignore tables by a regexp for ruby schema dump, but from now on if you use a SQL based structure dump, you can do so to by configuring ActiveRecord::SchemaDumper.ignor...
Read more
May 14, 2022

More async queries, pattern matching and no more autoclosed PRs!

Hi, this is Petrik, bringing you the latest news from the Rails world. Async aggregate and find_by queries Active Record async support was limited to loading collections, but among the not so fast queries that would benefit from asynchronicity you often find aggregates as well as hand crafted find_by_sql queries. We now support the fol...
Read more
March 27, 2022

Security improvements, reducing bytes and more!

Hi, this is Petrik, bringing you the latest news from the Rails world. Reduce the output of Rails::Railtie#inspect to the classname Anytime inspect was called on Rails::Application, it would output the very large application object. By reducing it to the classname, we also prevent leaking credentials. Remove body content from redirect ...
Read more
February 11, 2022

Rails 7.0.2, schema versioning based on the Rails version, and more

Hi, this is Petrik, bringing you the latest news from the Rails world. Rails 7.0.2 has been released While this looks like a regular patch release there are a few notable changes. First, one feature that was introduced in 7.0.0 was removed: the ability to pass a service_name param to DirectUploadsController. This feature was causing si...
Read more
February 5, 2022

Dart Sass for Rails, Fiber-aware connection pool and more!

Hi, this is Greg and Robin, bringing you the latest news from the Rails world. Dart Sass for Rails As Ruby Sass has been deprecated a long time ago and since Webpacker has been retired, a new gem that wraps the standalone executable version of the Dart version of Sass has been released and makes it easy to use Sass stylesheets with Rai...
Read more
January 21, 2022

Rails 7.0.1, Webpacker retirement and more

Hi, Wojtek here introducing you to this year changes in the Rails. Released Rails 7.0.1 The Ruby 3.1 is fully supported with this release. It also contains few bug fixes and documentation improvements. Retirement of Webpacker Only security issues will be considered and there will be no version 6 release of Webpacker. There is a switchi...
Read more
December 31, 2021

This Year in Rails! A summary of 2021 in the Rails world

Hi there, this is Greg, bringing you a summary of what happened in the Rails world in 2021. There were so many changes, it is difficult to decide which one to mention, but I tried my best to find a few notable changes Find and assert the presence of exactly one record Add FinderMethods#sole and #find_sole_by to find and assert the pres...
Read more
December 18, 2021

New releases, bugfixes and more!

Hi there, it is Greg, bringing you the latest news about Ruby on Rails! We had an exciting week, so let's get to it. Rails 7 has been released There are so many new features, I would rather not list them here, please read the announcement, it has all the details. As mentioned in the release announcement, there is a new look of the offi...
Read more
December 11, 2021

Rails 7.0 RC1, faster template rendering, better tests and much more!

Hi! Robin here, with the latest news from the Ruby on Rails world! Rails 7.0 RC1: New JavaScript Answers, At-Work Encryption, Query Origin Logging, Zeitwerk Exclusively With tons of new features and improvements like new ways to deal with JavaScript or at-work encryption, this new version of Rails should be released before Christmas! 🎉...
Read more
November 26, 2021

Composable blobs, improved upsert and much more!

Hey, Wojtek here with recent additions to Rails. All of them today for FREE, for you. Thank you all the contributors for making Rails. Those from one-time to day by day committers. Add compose method to Active Storage Blob Concatenating multiple blobs is now possible. Support custom metadata on Active Storage Setting custom metadata on...
Read more
November 20, 2021

Automated shard swapping middleware, standardised error reporting interface and more!

Hey, this is Greg, bringing you the latest news about Ruby on Rails. Support <form> elements without [action] By default, when a form is declared without an action attribute, browsers will encode the form's fields into the current URL. Prior to this commit, none of the form construction variations supported declaring a form without an ...
Read more
November 7, 2021

Nested attributes for delegated types, improved performances and more!

Hey! Robin here with the latest news from the Ruby on Rails world. Support accepts_nested_attributes_for for delegated types Rails 6.1 introduced delegated types to ease handling some polymorphic relationships. This pull request makes using `accepts_nested_attributes_for` on such types a piece of cake. Use nested queries doing UPDATE w...
Read more
October 31, 2021

🎃 Halloween Edition: Zeitwerk migration guide, selenium-webdriver, and some Ruby 3.1 snacks

🍭 Trick or treat, zzak here after a week off with lots of goodies! 🍬 Rails Autoloader Migration Guide: From Classic to Zeitwerk This new guide has all you need to know to switch the autoloader for Rails 6.x and 7.0 applications! Add ActiveRecord::Base.prohibit_shard_swapping This new method prohibits swapping shards within the given bl...
Read more
October 15, 2021

Auto timestamps on bulk inserts, HTML safe translations in controllers and more

Hey, Wojtek here with last week updates from the Ruby on Rails world. Set timestamps on insert_all/upsert_all record creation The timestamps will be automatically set when using bulk insert/upsert. This behaviour can be disabled by the record_timestamps config on the model class. Treat html suffix in controller translation When transla...
Read more
October 10, 2021

Automatic inverse_of, performance improvements and more!

Hi, this is Greg, bringing you the latest news about Ruby on Rails! This week we switched our newsletter delivery platform to HEY, if you are reading this email, you already confirmed your subscription and there is no other action needed on your end. Avoid instance_exec for controller callbacks This change brings some performance impro...
Read more
October 10, 2021

Autumn is here, and so is Rails 7 Alpha 2! 🍂

Hey! Zzak here with a JAM-PACKED edition of This Week In Rails. 🍇 Server Timing Middlware for Development This PR started nearly 2 and a half years ago, finally made its way into Rails! A really neat feature, uses the Server-Timing header to emit durations for all ActiveSupport::Notifications. You can then view these metrics in your br...
Read more

See more posts »