Skip to content
New issue

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

counter_cache validation fails with Rails 7.2.beta #1638

Open
jetienne opened this issue Jun 21, 2024 · 2 comments
Open

counter_cache validation fails with Rails 7.2.beta #1638

jetienne opened this issue Jun 21, 2024 · 2 comments

Comments

@jetienne
Copy link

Description

Testing counter_cache no longer works with Rails 7.2.beta.

Reproduction Steps

Define an association like this:

belongs_to :company, optional: true, counter_cache: true

The following test will fail:

it { is_expected.to belong_to(:company).optional.counter_cache(true) }

System configuration

shoulda-matchers (6.2.0)

@matsales28
Copy link
Member

Hi @jetienne, thanks for reporting that. We have a PR https://github.com/thoughtbot/shoulda-matchers/pull/1632/files that introduces compatibility between shoulda-matchers and Rails 7.2 and fixes this problem. We're waiting for the official release to merge it, to avoid any late change from the Rails team.

@steveclarke
Copy link

steveclarke commented Aug 14, 2024

Thanks @matsales28 I'm attempting to upgrade to Rails 7.2 now and hitting this issue. I'll temporarily disable the counter_cache checks until the PR is merged.

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

No branches or pull requests

3 participants