diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-10-19 21:07:56 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-10-19 21:07:56 +0900 |
commit | 207c37a1ec6cdbe9865d622de9bf0c7e2599bdcc (patch) | |
tree | 94808cf9366cb28b148d7c6f1ab73d7a529675d8 /activerecord | |
parent | a69f423e8b3adf6a4dcad44bbcdeddc94e103c7d (diff) | |
download | rails-207c37a1ec6cdbe9865d622de9bf0c7e2599bdcc.tar.gz rails-207c37a1ec6cdbe9865d622de9bf0c7e2599bdcc.tar.bz2 rails-207c37a1ec6cdbe9865d622de9bf0c7e2599bdcc.zip |
Test `ignored_columns` value is inheritable by subclasses
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 7 | ||||
-rw-r--r-- | activerecord/test/models/developer.rb | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 1a1d4ce039..79a1982b25 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1444,17 +1444,24 @@ class BasicsTest < ActiveRecord::TestCase cache_columns = Developer.connection.schema_cache.columns_hash(Developer.table_name) assert_includes cache_columns.keys, "first_name" assert_not_includes Developer.columns_hash.keys, "first_name" + assert_not_includes SubDeveloper.columns_hash.keys, "first_name" end test "ignored columns have no attribute methods" do refute Developer.new.respond_to?(:first_name) refute Developer.new.respond_to?(:first_name=) refute Developer.new.respond_to?(:first_name?) + refute SubDeveloper.new.respond_to?(:first_name) + refute SubDeveloper.new.respond_to?(:first_name=) + refute SubDeveloper.new.respond_to?(:first_name?) end test "ignored columns don't prevent explicit declaration of attribute methods" do assert Developer.new.respond_to?(:last_name) assert Developer.new.respond_to?(:last_name=) assert Developer.new.respond_to?(:last_name?) + assert SubDeveloper.new.respond_to?(:last_name) + assert SubDeveloper.new.respond_to?(:last_name=) + assert SubDeveloper.new.respond_to?(:last_name?) end end diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb index 56aafca60b..2a86fe9eba 100644 --- a/activerecord/test/models/developer.rb +++ b/activerecord/test/models/developer.rb @@ -87,6 +87,9 @@ class Developer < ActiveRecord::Base private :track_instance_count end +class SubDeveloper < Developer +end + class AuditLog < ActiveRecord::Base belongs_to :developer, validate: true belongs_to :unvalidated_developer, class_name: "Developer" |