Skip to content

activerecord: refine create/create! RBS signatures and update tests#1041

Open
kozy4324 wants to merge 1 commit into
ruby:mainfrom
kozy4324:activerecord-refine-create
Open

activerecord: refine create/create! RBS signatures and update tests#1041
kozy4324 wants to merge 1 commit into
ruby:mainfrom
kozy4324:activerecord-refine-create

Conversation

@kozy4324

Copy link
Copy Markdown
Contributor
  • Allow passing a block to create / create! .
  • Add overloads for attributes as an Array of hashes and array return types.
  • Add tests for create / create! .

Note on file placement

The create / create! signatures are defined in activerecord-8.0.rbs rather than activerecord.rbs, because these methods are statically defined in Ruby source, not dynamically generated at runtime. The activerecord.rbs file already declares extend ::ActiveRecord::Persistence::ClassMethods on ActiveRecord::Base, so the type checker resolves them through that module naturally. Is this reasoning correct?

@github-actions

Copy link
Copy Markdown

@kozy4324 Thanks for your contribution!

Please follow the instructions below for each change.
See also: https://github.com/ruby/gem_rbs_collection/blob/main/docs/CONTRIBUTING.md

Available commands

You can use the following commands by commenting on this PR.

  • /merge: Merge this PR if CI passes

activerecord

You changed RBS files for an existing gem.
You need to get approval from the reviewers of this gem.

@hibariya, @ksss, @Little-Rubyist, @tk0miya, please review this pull request.
If this change is acceptable, please make a review comment including APPROVE from here.
Screen Shot 2024-03-19 at 14 13 36

After that, the PR author or the reviewers can merge this PR.
Just comment /merge to merge this PR.

- Allow passing a block to `create` / `create!` .
- Add overloads for `attributes` as an Array of hashes and array return types.
@kozy4324 kozy4324 force-pushed the activerecord-refine-create branch from 787526e to d684193 Compare June 17, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant