From ec13305b21d7146417b17a2cdf976bbc5cac2189 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 24 Dec 2010 22:15:41 -0700 Subject: stop redifining methods on every call to set_primary_key --- activerecord/test/cases/inheritance_test.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/test/cases/inheritance_test.rb') diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb index c3da9cdf53..6abbe45492 100644 --- a/activerecord/test/cases/inheritance_test.rb +++ b/activerecord/test/cases/inheritance_test.rb @@ -219,6 +219,10 @@ class InheritanceTest < ActiveRecord::TestCase switch_to_default_inheritance_column end + def test_inherits_custom_primary_key + assert_equal Subscriber.primary_key, SpecialSubscriber.primary_key + end + def test_inheritance_without_mapping assert_kind_of SpecialSubscriber, SpecialSubscriber.find("webster132") assert_nothing_raised { s = SpecialSubscriber.new("name" => "And breaaaaathe!"); s.id = 'roger'; s.save } -- cgit v1.2.3 From a6fe244e9b05c60aac88842a38fb2b6285d5571b Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sat, 25 Dec 2010 15:23:45 -0700 Subject: take more advantage of arel sql compiler --- activerecord/test/cases/inheritance_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/test/cases/inheritance_test.rb') diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb index 6abbe45492..9fac9373eb 100644 --- a/activerecord/test/cases/inheritance_test.rb +++ b/activerecord/test/cases/inheritance_test.rb @@ -208,7 +208,7 @@ class InheritanceTest < ActiveRecord::TestCase def test_eager_load_belongs_to_primary_key_quoting con = Account.connection - assert_sql(/\(#{con.quote_table_name('companies')}.#{con.quote_column_name('id')} = 1\)/) do + assert_sql(/#{con.quote_table_name('companies')}.#{con.quote_column_name('id')} = 1/) do Account.find(1, :include => :firm) end end -- cgit v1.2.3 From 839f3bf6822ed3698df1e606c4215d650312f33e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 7 Jan 2011 11:28:11 -0800 Subject: just use a hash for doing association caching --- activerecord/test/cases/inheritance_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/test/cases/inheritance_test.rb') diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb index 9fac9373eb..680d4ca5dd 100644 --- a/activerecord/test/cases/inheritance_test.rb +++ b/activerecord/test/cases/inheritance_test.rb @@ -203,7 +203,7 @@ class InheritanceTest < ActiveRecord::TestCase def test_eager_load_belongs_to_something_inherited account = Account.find(1, :include => :firm) - assert_not_nil account.instance_variable_get("@firm"), "nil proves eager load failed" + assert account.association_cache.key?(:firm), "nil proves eager load failed" end def test_eager_load_belongs_to_primary_key_quoting -- cgit v1.2.3