From 7550f0a016ee6647aaa76c0c0ae30bebc3867288 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Sat, 18 Jul 2015 10:28:24 -0400 Subject: Ensure cyclic associations w/ autosave don't cause duplicate errors This code is so fucked. Things that cause this bug not to replicate: - Defining the validation before the association (we end up calling `uniq!` on the errors in the autosave validation) - Adding `accepts_nested_attributes_for` (I have no clue why. The only thing it does that should affect this is adds `autosave: true` to the inverse reflection, and doing that manually doesn't fix this). This solution is a hack, and I'm almost certain there's a better way to go about it, but this shouldn't cause a huge hit on validation times, and is the simplest way to get it done. Fixes #20874. --- activerecord/test/schema/schema.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/test/schema') diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index 6872b49ad9..2fc806f181 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -678,6 +678,10 @@ ActiveRecord::Schema.define do t.datetime :updated_at end + create_table :prisoners, force: true do |t| + t.belongs_to :ship + end + create_table :speedometers, force: true, id: false do |t| t.string :speedometer_id t.string :name -- cgit v1.2.3