|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "relative_time_in_words, current transaction's isolation level and more!" |
| 4 | +categories: news |
| 5 | +author: gregmolnar |
| 6 | +og_image: assets/images/this-week-in-rails.png |
| 7 | +published: true |
| 8 | +date: 2025-08-01 |
| 9 | +--- |
| 10 | + |
| 11 | + |
| 12 | +Hi, it's [gregmolnar](https://github.com/gregmolnar). Let's explore this week's changes in the Rails codebase. |
| 13 | + |
| 14 | +[New written & video tutorials for beginners](https://rubyonrails.org/2025/7/31/new-beginner-resources) |
| 15 | +The Rails Foundation has launched a few more learning resources for beginners, in partnership with Chris Oliver and the team behind Typecraft - Chris Power and Robert Beene. |
| 16 | + |
| 17 | +[Log when `rescue_from` handles an exception](https://github.com/rails/rails/pull/55424) |
| 18 | +This pull request adds a log message indicating when an exception was raised in |
| 19 | +`before_action` callbacks. |
| 20 | + |
| 21 | +[Allow hosts redirects from `hosts` Rails configuration](https://github.com/rails/rails/pull/55420) |
| 22 | +With this change, it is possible to allow hosts redirects from the Rails configuration: |
| 23 | +```ruby |
| 24 | + config.action_controller.allowed_redirect_hosts << "example.com" |
| 25 | +``` |
| 26 | + |
| 27 | +[rate_limit notification instrumentation to include more payload](https://github.com/rails/rails/pull/55418) |
| 28 | +To make it easier to move from rack-attack to the built-in rate limiter, the `rate_limit.action_controller` notification now has the following additional payload values: count, to, within, by, name, cache_key. |
| 29 | + |
| 30 | +[Provide a method to check current transaction's isolation level](https://github.com/rails/rails/pull/55407) |
| 31 | +This pull request adds `connection.current_transaction.isolation` API to check current transaction's isolation level. |
| 32 | +It returns the isolation level if it was explicitly set via the `isolation:` parameter |
| 33 | +or through `ActiveRecord.with_transaction_isolation_level`, otherwise returns `nil`. |
| 34 | +Nested transactions return the parent transaction's isolation level. |
| 35 | + |
| 36 | +[Add `relative_time_in_words` helper to ActionView](https://github.com/rails/rails/pull/55405) |
| 37 | +This pull request introduces a `relative_time_in_words` helper: |
| 38 | + |
| 39 | +```ruby |
| 40 | +relative_time_in_words(3.minutes.from_now) # => "in 3 minutes" |
| 41 | +relative_time_in_words(3.minutes.ago) # => "3 minutes ago" |
| 42 | +relative_time_in_words(10.seconds.ago, include_seconds: true) # => "less than 10 seconds ago" |
| 43 | +``` |
| 44 | + |
| 45 | +_You can view the whole list of changes [here](https://github.com/rails/rails/compare/@%7B2025-07-25%7D...main@%7B2025-08-01%7D)._ |
| 46 | +_We had [22 contributors](https://contributors.rubyonrails.org/contributors/in-time-window/20250725-20250801) to the Rails codebase this past week!_ |
| 47 | + |
| 48 | +Until next time! |
| 49 | + |
| 50 | +_[Subscribe](https://world.hey.com/this.week.in.rails) to get these updates mailed to you._ |
0 commit comments