RBS for Rails: Is there any plan about it?

Ruby 3.0 has this RBS feature which can help us do static analytics and gain more code intelligence such as auto completion.

Wonder whether integrating RBS into Rails has been tracked?

2 Likes

One attempt is https://github.com/pocke/rbs_rails to add Rake task to generate RBS files.

1 Like

I’m the author of RBS Rails and a maintainer of RBS. Thanks for opening this topic, and mentioning my product.

RBS Rails is responsible for generating application-specific RBSs from the configuration. Currently it supports AR models and routing helpers. For example, it generates User#name method’s RBS from DB schema.

We have another project to integrate RBS and Rails. It is ruby/gem_rbs_collection. The repository stores gems’ RBSs. You can imagine DefinitelyTyped if you use TypeScript. Currently it has auto-generated Rails related gems’ RBSs. For example: https://github.com/ruby/gem_rbs_collection/blob/81ace2c598ec871572beee5792e2a2781b35e762/gems/activesupport/6.0/activesupport-generated.rbs

Currently they are under development. You can try to type check in your Rails app, but you will encounter bugs RBS Rails and incorrect type signatures. Feedbacks are really welcome :slight_smile:

10 Likes

Hello,

sorry for bumping this relative old thread, but I’m also looking for a possibility to use better typing possibilities with the Rails framework inside other gems and applications.

I’ve looked at the gem_rbs_collection and saw it only contains resources for the Rails 6.0 release. Is this project still the way to go to introduce typing into other gems, or would the idea of making a pull request for Rails to add the RBS files that way make more sense at this point?

I’m more than happy to put in the required work to get these files going, just looking for some input on what the desired approach would be for getting this going.