Files
discourse/lib/service
Loïc Guitaut 08df9a7ebb DEV: Fix the lock step when using contracts (#38019)
Recently, the `lock` step from our Ruby service framework has been
extended to be able to work with keys from the global context when the
key isn’t present in the `params`.

The implementation is flawed because we usually get a contract object in
the `params` key of the context, and currently we call
`public_send(key)` on it. This actually raises an error when the key
doesn’t exist on the contract.

The fix is rather simple, we just use `try` instead, that way if the
method doesn’t exist, it returns `nil`, allowing us to get the key from
the global context as expected.
2026-02-24 12:30:38 +01:00
..