

ErrorReporter#unexpected, with_routing test helpers and more!
source link: https://rubyonrails.org/2023/11/24/this-week-in-rails
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Friday, November 24, 2023
ErrorReporter#unexpected, with_routing test helpers and more!
Posted by vipulnsward
Happy Thanksgiving weekend everyone! This is Vipul bringing you the latest from this week’s changes in the Rails codebase.
ErrorReporter#unexpected to report in production but raise in development
This change adds ErrorReported#unexpected
to report precondition violations.
For example:
def edit
if published?
Rails.error.unexpected("[BUG] Attempting to edit a published article, that shouldn't be possible")
return false
end
# ...
end
The above will raise an error in development and test, but only report the error in production.
Make with_routing test helper work for integration tests
with_routing
test helper support has now been added to ActionDispatch::IntegrationTest
to allow usage in integration tests.
Support nested elements inside button tag in Active Storage uploads This change addresses a potential issue that could arise when a button or an input of type submit contains child elements, such as spans, icons, or other HTML elements.
Remove deprecations This PR is an ongoing effort to remove all deprecated code, marked as deprecated for Rails 7.2. Checkout the PR for all things going away and if you are handling them already!
Handle case in MySQL where the ActiveRecord.db_warnings_action is not called even when a DB query has warnings
This change handles cases where MySQL returns warning_count
greater than zero, but returns no warnings when the SHOW WARNINGS
query is executed,
ActiveRecord.db_warnings_action
proc will still be called with a generic warning message rather than silently ignoring the warning(s).
Delay validation of registered Active Record adapters and allow aliasing of adapters
This change is from an ongoing effort to allow aliasing of DB adapters by name. The end state here is to allow mysql
to be mapped to either trilogy
or mysql2
at an application level.
You can view the whole list of changes here. We had 20 contributors to the Rails codebase this past week!
Until next time!
Subscribe to get these updates mailed to you.
Recommend
-
182
README.md
-
14
Contributor seanpdoyle commented
-
3
Blazor Helpers App: More on Includes with Selections Another look at using .Includes when using Entity Framework to query a SQL Server database as part of a Blazor Server app.. ...
-
4
How to test custom Json objects with spray routing advertisements I'm creating a Rest API with spray-routing on top of mongodb for some CRUD operat...
-
15
In this post I describe a new feature in C# 10, the [CallerArgumentExpression] attribute, how it can be used to create "throw helpers", and the addition of a throw helper to ArgumentNullException. [Call...
-
7
nazhaAbout MeFollow MePolyfills and helpers - How to save your bundle sizePublished on...
-
1
September 19, 2023 System.Text.Json JsonConverter Test Helpers ...
-
12
Understanding Generators, Iterators, and Iterator Helpers in JavaScript Nov 23, 2023 •
-
5
Rails introduces ErrorReporter#unexpected for reporting precondition violations Feb 8, 2024 • ...
-
5
Using test helpers in Go February 15, 2024 - Estimated reading time: 5 minutes - Translations:
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK