Hi, Wojtek here. Let’s explore last 2 week’s changes in the Rails codebase.
Add capture_error_reports
Captures all reported errors from within the block that match the given error class.
reports = capture_error_reports(IOError) do
Rails.error.report(IOError.new("What a Terrible Failure"))
Rails.error.report(StandardError.new)
end
assert_equal 1, reports.size
assert_equal "What a Terrible Failure", reports.first.error.message
Don’t always escape JSON when rendering from controller
The JSON renderer doesn’t escape HTML entities or Unicode line separators anymore.
Since the renderer is used to return a JSON document as application/json, it’s typically not necessary to escape those…
You can use the escape: true…