aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations
diff options
context:
space:
mode:
authorPrathamesh Sonpatki <csonpatki@gmail.com>2013-07-29 09:22:14 +0530
committerPrathamesh Sonpatki <csonpatki@gmail.com>2014-02-20 10:34:52 +0530
commit9694f86de65e9162a6802a43cdbce9ccc85285b5 (patch)
tree754cd6e873fadfb4a07f917744038bf830703dfe /activerecord/test/cases/associations
parent25ce856c3ea8beb864994b4b13df07b48574df9b (diff)
downloadrails-9694f86de65e9162a6802a43cdbce9ccc85285b5.tar.gz
rails-9694f86de65e9162a6802a43cdbce9ccc85285b5.tar.bz2
rails-9694f86de65e9162a6802a43cdbce9ccc85285b5.zip
[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
Diffstat (limited to 'activerecord/test/cases/associations')
-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 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