We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ActiveRecord::Associations::CollectionProxy#build
When creating a new ActiveRecord model through an association, for example:
class Post < ActiveRecord::Base has_many comments end class Comment < ActiveRecord::Base belongs_to :post end post = Post.new comment = post.comments.new
the current type definitions throw an error when validating in Steep due to an incorrect signature:
[error] The method cannot be called without a block │ Diagnostic ID: Ruby::RequiredBlockMissing │ └ @comment = post.comments.new ~~~
This specific one comes from ActiveRecord::Associations::CollectionProxy#new(build), which is defined on https://github.com/ruby/gem_rbs_collection/blob/main/gems/activerecord/6.0/activerecord-generated.rbs#L1156-L1158
ActiveRecord::Associations::CollectionProxy#new(build)
def build: (?::Hash[untyped, untyped] attributes) { () -> untyped } -> untyped alias new build
The patch to fix it is to make the block optional, ie ?{ () -> untyped }
?{ () -> untyped }
There is another method definition under ActiveRecord::AssociationRelation that likely also needs to be updated: https://github.com/ruby/gem_rbs_collection/blob/main/gems/activerecord/6.0/activerecord-generated.rbs#L259-L261
ActiveRecord::AssociationRelation
I'm happy to make a PR to address, but not sure if you would prefer to update the generated files or the patch.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When creating a new ActiveRecord model through an association, for example:
the current type definitions throw an error when validating in Steep due to an incorrect signature:
[error] The method cannot be called without a block │ Diagnostic ID: Ruby::RequiredBlockMissing │ └ @comment = post.comments.new ~~~
This specific one comes from
ActiveRecord::Associations::CollectionProxy#new(build)
, which is defined on https://github.com/ruby/gem_rbs_collection/blob/main/gems/activerecord/6.0/activerecord-generated.rbs#L1156-L1158The patch to fix it is to make the block optional, ie
?{ () -> untyped }
There is another method definition under
ActiveRecord::AssociationRelation
that likely also needs to be updated: https://github.com/ruby/gem_rbs_collection/blob/main/gems/activerecord/6.0/activerecord-generated.rbs#L259-L261I'm happy to make a PR to address, but not sure if you would prefer to update the generated files or the patch.
The text was updated successfully, but these errors were encountered: