1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

1 commit

Author SHA1 Message Date
Will Jessop
6ea80b6103
Don't validate non dirty association targets
Fixes #36581.

This fixes an issue where validations would return differently when a previously saved invalid association was loaded between calls:

    assert_equal true, squeak.valid?
    assert_equal true, squeak.mouse.present?
    assert_equal true, squeak.valid?

Here the second assert would return

    Expected: true
    Actual: false

Limiting validations to associations that would be normally saved (using autosave: true) due to changes means that loading invalid associated relations will not change the return value of the parent relations's `valid?` method.
2019-07-15 18:21:20 +01:00