mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
6ea80b6103
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.
6 lines
138 B
Ruby
6 lines
138 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Mouse < ActiveRecord::Base
|
|
has_many :squeaks, autosave: true
|
|
validates :name, presence: true
|
|
end
|