Hi, it’s Greg. Let’s explore this week’s changes in the Rails codebase.
New written & video tutorials for beginners
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.
Log when rescue_from handles an exception
This pull request adds a log message indicating when an exception was raised in before_action callbacks.
Allow hosts redirects from hosts Rails configuration
With this change, it is possible to allow hosts redirects from the Rails configuration:
config.action_controller.allowed_redirect_hosts << "example.com"
rate_limit notification instrumentation to include more payload
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.
Provide a method to check current transaction’s isolation level
This pull request adds connection.current_transaction.isolation API to check current transaction’s isolation level. It returns the isolation level if it was explicitly set via the isolation: parameter or through ActiveRecord.with_transaction_isolation_level, otherwise returns nil. Nested transactions return the parent transaction’s isolation level.
Add relative_time_in_words helper to ActionView
This pull request introduces a relative_time_in_words helper:
relative_time_in_words(3.minutes.from_now) # => "in 3 minutes" relative_time_in_words(3.minutes.ago) # => "3 minutes ago" relative_time_in_words(10.seconds.ago, include_seconds: true) # => "less than 10 seconds ago"
You can view the whole list of changes here. We had 22 contributors to the Rails codebase this past week!
Until next time!