diff options
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/belongs_to_associations_test.rb | 18 |
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 9340bc0a83..d172ee2e7a 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -863,4 +863,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 |