-
Notifications
You must be signed in to change notification settings - Fork 618
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
Model#valid? Returning True For Invalid Records After Import #824
Comments
Running in to the same problem. Using Rails 5 did you figure out a reason or fix for this ? |
No, awaiting any feedback |
It seems |
So it doesn't seem like a different record is being pulled from the db. Somehow |
Strange, I wonder why |
have you tried adding |
No, I don't want to raise errors, otherwise |
When I attempt to import a record that is invalid due to a uniqueness constraint, a number of
ActiveModel
methods are returning unexpected results. Specifically,valid?
returns true after the import despite the record being invalid.For example, I have a
Post
model withname
andcompany_id
attributes and a uniqueness validation likevalidates :name, uniqueness: { scope: :company_id }
.Then if I run an import, the return values change:
I'd expect the return values of
valid?
andnew_record?
to remain the same after the import.I'm using Rails 7.1 with Postgres.
The text was updated successfully, but these errors were encountered: