sorbet-rails icon indicating copy to clipboard operation
sorbet-rails copied to clipboard

Signatures not generated for models using new ActiveRecord::DelegatedType

Open cguess opened this issue 3 years ago • 0 comments

Describe the bug: When using the new DelegatedType feature in Rails 6.1 there are not signatures generated for delegated types from a base class, causing errors since it can't detect that the method is available.

Steps to reproduce: Follow the steps as outlined in the Rails documentation to create a delegated type, for instance let's say Item is the base class and Book is the delegated type. Then run bundle exec rake rails_rbi:models to generate everything normally.

From there, in a controller write Item.books (which will run fine) and it will report "Method books does not exist on T.class_of(Item)" when checking level is more than false.

Expected behavior: I would expect definitions to be read in this and be generated so that an array of Book would be expected to respond.

Versions:

  • Ruby: 3.0.1
  • Rails: 6.1.3.2
  • Sorbet: 0.5.6424
  • Sorbet-Rails: 0.7.4

cguess avatar Jun 03 '21 15:06 cguess