A Software Gardener and Mentor, using Rust and Ruby to build high quality software.
Whenever you have a block of code that will run in some other context, Sorbet will not find the methods in the block of code that are not present in the context where it is written.
You can specify the context both in the definition of the function that recieves
the block, as in the block itself, using T.bind
, like so:
class ApplicationController < ActionController::API
rescue_from ActiveRecord::RecordNotFound do |e|
T.bind(self, ApplicationController)
render_errors([message], status: :not_found)
end
end
This way we might be able to bump more complex files to typed: strict
.
To keep learning about blocks the recommended reading is the documentation itself.