It's a common useful pattern for situation where something isn't supposed to happen, but if it does we can recover from it. So in such situation you don't want such issue to be hidden in development or test, as it's likely a bug, but do not want to fail a request if it happens in production. In other words, it behaves like `#record` in development and test environments, and like `raise` in production. Fix: https://github.com/rails/rails/pull/49638 Fix: https://github.com/rails/rails/pull/49339 Co-Authored-By: Andrew Novoselac <andrew.novoselac@shopify.com> Co-Authored-By: Dustin Brown <dbrown9@gmail.com>
2.5 KiB
-
Add
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.
Jean Boussier
-
Make the order of read_multi and write_multi notifications for
Cache::Store#fetch_multi
operations match the order they are executed in.Adam Renberg Tamm
-
Make return values of
Cache::Store#write
consistent.The return value was not specified before. Now it returns
true
on a successful write,nil
if there was an error talking to the cache backend, andfalse
if the write failed for another reason (e.g. the key already exists andunless_exist: true
was passed).Sander Verdonschot
-
Fix logged cache keys not always matching actual key used by cache action.
Hartley McGuire
-
Improve error messages of
assert_changes
andassert_no_changes
assert_changes
error messages now display objects with.inspect
to make it easier to differentiate nil from empty strings, strings from symbols, etc.assert_no_changes
error messages now surface the actual value.pcreux
-
Fix
#to_fs(:human_size)
to correctly work with negative numbers.Earlopain
-
Fix
BroadcastLogger#dup
so that it duplicates the logger'sbroadcasts
.Andrew Novoselac
-
Fix issue where
bootstrap.rb
overwrites thelevel
of aBroadcastLogger
'sbroadcasts
.Andrew Novoselac
-
Fix compatibility with the
semantic_logger
gem.The
semantic_logger
gem doesn't behave exactly like stdlib logger in thatSemanticLogger#level
returns a Symbol while stdlibLogger#level
returns an Integer.This caused the various
LogSubscriber
classes in Rails to break when assigned aSemanticLogger
instance.Jean Boussier, ojab
-
Fix MemoryStore to prevent race conditions when incrementing or decrementing.
Pierre Jambet
-
Implement
HashWithIndifferentAccess#to_proc
.Previously, calling
#to_proc
onHashWithIndifferentAccess
object used inherited#to_proc
method from theHash
class, which was not able to access values using indifferent keys.fatkodima
Please check 7-1-stable for previous changes.