Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Signatures not generated for models using new ActiveRecord::DelegatedType #424

Open
cguess opened this issue Jun 3, 2021 · 0 comments
Open
Labels
bug Something isn't working

Comments

@cguess
Copy link

cguess commented Jun 3, 2021

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 cguess added the bug Something isn't working label Jun 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant