aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/belongs_to_associations_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb
index a65f2da7a0..091c94676e 100644
--- a/activerecord/test/cases/associations/belongs_to_associations_test.rb
+++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb
@@ -885,4 +885,22 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase
end
end
end
+
+ test 'belongs_to works with model name Record' do
+ Record = Class.new(ActiveRecord::Base) do
+ connection.create_table :records
+ end
+
+ Foo = Class.new(ActiveRecord::Base) do
+ connection.create_table :foos do |t|
+ t.belongs_to :record
+ end
+
+ belongs_to :record
+ end
+
+ record = Record.create!
+ Foo.create! record: record
+ assert_equal 1, Foo.count
+ end
end