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

ActiveRecord_Relation used in types is private #217

Closed
ilyakatz opened this issue Oct 30, 2019 · 2 comments
Closed

ActiveRecord_Relation used in types is private #217

ilyakatz opened this issue Oct 30, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@ilyakatz
Copy link

Describe the bug:

Method signatures for models in many cases use Model::ActiveRecord_Relation.
However, that is a private constant (rails/rails#30943)

Steps to reproduce:

Generate any model types

  1. rake "rails_rbi:models[Document]
  2. This creates rbi file with multiple method signatures that look like
  sig { params(args: T.untyped).returns(Document::ActiveRecord_Relation) }
  def self.sorted_by(*args); end

Expected behavior:

Not entirely sure.

What's interesting is that when I try to access the constant in development but not in non-dev environments.

irb(main):002:0> Rails.env
=> "development"
irb(main):003:0> Document::ActiveRecord_Relation
=> Document::ActiveRecord_Relation
irb(main):024:0> Rails.env
=> "qa"
irb(main):025:0> Document::ActiveRecord_Relation
Traceback (most recent call last):
        1: from (irb):25
NameError (private constant #<Class:0x0000559833e401d0>::ActiveRecord_Relation referenced)

Versions:

  • Ruby: 2.6.0p0
  • Rails: 5.2.3
  • Sorbet: 0.4.4782
  • Sorbet-Rails: 0.5.8.1
@ilyakatz ilyakatz added the bug Something isn't working label Oct 30, 2019
@ilyakatz
Copy link
Author

sorry, seems to be a dup #211

@hdoan741
Copy link
Contributor

@ilyakatz We have a logic to make them dynamic to use in sorbet signature and stuff! Check out #211

We're trying to improve the documentation for it in #214

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

2 participants