From 9694f86de65e9162a6802a43cdbce9ccc85285b5 Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Mon, 29 Jul 2013 09:22:14 +0530 Subject: [Active Record] Renamed private methods create_record and update_record This is to ensure that they are not accidentally called by the app code. They are renamed to _create_record and _update_record respectively. Closes #11645 --- .../cases/associations/belongs_to_associations_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'activerecord/test/cases/associations') 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 -- cgit v1.2.3