
A set of tools to make the Sorbet typechecker work with Ruby on Rails seamlessly.
The sorbet-rails gem is a powerful tool designed to enhance the Sorbet typechecker experience for Ruby on Rails applications. As a bridge between the two frameworks, it ensures that developers can seamlessly work with dynamic methods generated by Rails while maintaining type safety. Although it is essential to note that support for Rails 4.2 has been deprecated, sorbet-rails is fully compatible with Rails 5 and later, making it a crucial utility for modern applications.
With its array of features, sorbet-rails significantly simplifies the task of generating Ruby Interface (RBI) files for various components within a Rails app. This includes models, routes, and helpers, allowing for improved type-checking capabilities. Transitioning to this gem requires a straightforward setup, enabling teams to enhance their codebase's reliability with minimal friction.
Automatic RBI Generation: Automatically generate RBI files for routes, models, and helpers, enhancing type-checking in your app.
ActiveRecord Support: Generates RBI files that include signatures for all ActiveRecord models, including associations and enums.
Type-safe Pluck: Introduces the pluck_to_tstruct method, which retrieves values from the database while preserving type information, enhancing data integrity.
Custom RBI Logic: Offers a plugin system that allows developers to add custom RBI generation logic for tailored functionalities.
Enhanced Enums: Replaces traditional Rails enums with typed_enum, providing improved type safety and clarity in your application.
Scoped Generations: Generate RBI files for specific models, including those with single table inheritance, ensuring all necessary subclasses are covered.
Ease of Integration: Simple setup process that involves adding the gem to your Gemfile and running bundled installations, ensuring quick deployment for new projects.
Support for Modern Rails: Exclusively supports Rails 5+ applications, ensuring compatibility with newer features and functionalities in the Rails framework.

Ruby on Rails, often referred to as Rails, is an open-source web application framework written in Ruby. Known for its convention over configuration and don't repeat yourself (DRY) principles, Rails simplifies and accelerates the development of database-backed web applications.