aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/schema
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2015-09-26 16:07:24 -0400
committereileencodes <eileencodes@gmail.com>2015-09-26 16:26:56 -0400
commitee824c8858f2a14aa3014877310971795348e460 (patch)
treea3baf298942d698cc87b149112f7c4dedbc5b30a /activerecord/test/schema
parent7f18ea14c893cb5c9f04d4fda9661126758332b5 (diff)
downloadrails-ee824c8858f2a14aa3014877310971795348e460.tar.gz
rails-ee824c8858f2a14aa3014877310971795348e460.tar.bz2
rails-ee824c8858f2a14aa3014877310971795348e460.zip
Fix regression in inverse_of on through associations
`inverse_of` on through associations was accidently removed/caused to stop working in commit f8d2899 which was part of a refactoring on `ThroughReflection`. To fix we moved `inverse_of` and `check_validity_of_inverse!` to the `AbstractReflection` so it's available to the `ThroughReflection` without having to dup any methods. We then need to delegate `inverse_name` method in `ThroughReflection`. `inverse_name` can't be moved to `AbstractReflection` without moving methods that set the instance variable `@automatic_inverse_of`. This adds a test that ensures that `inverse_of` on a `ThroughReflection` returns the correct class name, and the correct record for the inverse relationship. Fixes #21692
Diffstat (limited to 'activerecord/test/schema')
-rw-r--r--activerecord/test/schema/schema.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb
index 4b7272f10a..d334a2740e 100644
--- a/activerecord/test/schema/schema.rb
+++ b/activerecord/test/schema/schema.rb
@@ -252,6 +252,7 @@ ActiveRecord::Schema.define do
t.string :name
t.string :first_name
t.integer :salary, default: 70000
+ t.integer :firm_id
if subsecond_precision_supported?
t.datetime :created_at, precision: 6
t.datetime :updated_at, precision: 6
@@ -658,6 +659,7 @@ ActiveRecord::Schema.define do
create_table :projects, force: true do |t|
t.string :name
t.string :type
+ t.integer :firm_id
end
create_table :randomly_named_table1, force: true do |t|