A gem that generates RBI files and provides runtime helpers to integrate Sorbet static type checking with Ruby on Rails applications.
Sorbet Rails is a Ruby gem that provides tools to integrate the Sorbet static type checker with Ruby on Rails applications. It generates Ruby Interface (RBI) files for Rails' dynamically generated methods—such as model associations, scopes, and routes—enabling Sorbet to understand and type-check them. The gem also includes runtime helpers like `typed_enum` and `pluck_to_tstruct` to offer type-safe alternatives to common Rails patterns.
Ruby on Rails developers who are adopting Sorbet for static type checking and need to handle Rails' dynamic metaprogramming and conventions in a type-safe manner.
It significantly reduces the manual effort required to add Sorbet type signatures to Rails applications by automatically generating RBI files for Rails' magic methods and providing typed helpers that align with Rails idioms, making the codebase more robust and maintainable.
A set of tools to make the Sorbet typechecker work with Ruby on Rails seamlessly.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Generates RBI files for Rails models, routes, helpers, mailers, and jobs, automatically providing type signatures for dynamic methods like ActiveRecord associations and enums, reducing manual annotation work.
Offers type-safe alternatives such as pluck_to_tstruct for efficient queries and typed_enum for enums, enhancing code robustness while maintaining Rails idioms.
Includes TypedParams to coerce and validate controller parameters into typed T::Struct objects, improving API safety and reducing boilerplate for parameter handling.
Supports custom plugins to generate RBI for third-party gems like Kaminari or Shrine, allowing seamless integration with other libraries in a typed environment.
The project is officially deprecated and no longer maintained, with users advised to migrate to Tapioca, leading to potential security risks and incompatibilities with newer Rails versions.
Does not support all Rails dynamic methods, such as attribute custom types or some callbacks, requiring manual RBI overrides and increasing maintenance burden.
Requires running multiple Rake tasks for RBI generation and often needs workarounds for issues like unscoped blocks or select with columns, adding to initial configuration complexity.
Only supports Rails 5+ and has dropped support for older versions like Rails 4.2, making it unsuitable for legacy applications without upgrades.