Skip to content

Improve typing of ActiveRecord/ActiveModel/Discard callbacks - #428

Open
frewsxcv wants to merge 1 commit into
Shopify:mainfrom
frewsxcv:claude/nice-keller-q1ftxt
Open

frewsxcv wants to merge 1 commit into
Shopify:mainfrom
frewsxcv:claude/nice-keller-q1ftxt

Conversation

@frewsxcv

Copy link
Copy Markdown
Contributor
  • Fix around_* block signatures: around callbacks receive the record and a block that continues the callback chain.
  • Add sigs for after_{create,update,save,destroy}_commit.
  • Type self/record in Discard callbacks using T.attached_class instead of T.untyped.
  • Add sigs for before_validation/after_validation on ActiveModel::Validations::Callbacks::ClassMethods so non-ActiveRecord models get typed callback blocks.

- Fix `around_*` block signatures: around callbacks receive the record
  and a block that continues the callback chain.
- Add sigs for `after_{create,update,save,destroy}_commit`.
- Type `self`/record in Discard callbacks using `T.attached_class`
  instead of `T.untyped`.
- Add sigs for `before_validation`/`after_validation` on
  `ActiveModel::Validations::Callbacks::ClassMethods` so non-ActiveRecord
  models get typed callback blocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UgrYvjdHEbaCREnuLkKRQg
@frewsxcv
frewsxcv requested a review from a team as a code owner September 28, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants