-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
collection.<< counter cache doesn't respect validations #3085
Comments
Thanks for the great bug report :) What versions are affected? Is this a regression from 3.0? |
Hi @jonleighton, sorry for not mentioning the version: I have tested it on 3.1.0 (current gem release) and current master branch, I'll try later to run it on 3.0, will report back! |
I tried the 3-0-stable branch:
it bombs, but maybe it's my setup, not sure:
|
Tried also with the 3.0.10 gem, this is the result, better than the previous but the same code raises, this is different behaviour from 3.1.0 and master tests in the first post:
|
I changed a lot of code and I took a look back at this ticket, it seems ok in Rails 3.2.2, validation failed exception is always thrown but counter cache behavior seems in check in my specs. |
I am on 4.2.5 here is an issue: |
Please see and run the brief test script, it should demonstrate the issue.
In substance given a has_many :through and validations on the join model ActiveRecord correctly respects them when adding objects to the collection, but the automatic counter cache slips through
and gets fired in any case.
The text was updated successfully, but these errors were encountered: