aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/schema/schema.rb
diff options
context:
space:
mode:
authorGodfrey Chan <godfreykfc@gmail.com>2014-02-13 11:49:19 -0800
committerGodfrey Chan <godfreykfc@gmail.com>2014-02-23 11:00:55 -0800
commit41554319f8454f667b5e315339d3e286dbf6e1a4 (patch)
tree6b429827488b2ca7f34095d5f74f208ea6a8301f /activerecord/test/schema/schema.rb
parent96759cf6c6a17053abb6a2b7cd87cdbd5a8420ba (diff)
downloadrails-41554319f8454f667b5e315339d3e286dbf6e1a4.tar.gz
rails-41554319f8454f667b5e315339d3e286dbf6e1a4.tar.bz2
rails-41554319f8454f667b5e315339d3e286dbf6e1a4.zip
Fixed STI classes not defining an attribute method if there is a
conflicting private method defined on its ancestors. The problem is that `method_defined_within?(name, klass, superklass)` only works correclty when `klass` and `superklass` are both `Class`es. If both `klass` and `superklass` are both `Class`es, they share the same inheritance chain, so if a method is defined on `klass` but not `superklass`, this method must be introduced at some point between `klass` and `superklass`. This does not work when `superklass` is a `Module`. A `Module`'s inheritance chain contains just itself. So if a method is defined on `klass` but not on `superklass`, the method could still be defined somewhere upstream, e.g. in `Object`. This fix works by avoiding calling `method_defined_within?` with a module while still fufilling the requirement (checking that the method is defined withing `superclass` but not is not a generated attribute method). 4d8ee288 is likely an attempted partial fix for this problem. This unrolls that fix and properly check the `superclass` as intended. Fixes #11569.
Diffstat (limited to 'activerecord/test/schema/schema.rb')
-rw-r--r--activerecord/test/schema/schema.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb
index 99a53434f6..5f2d6acbcb 100644
--- a/activerecord/test/schema/schema.rb
+++ b/activerecord/test/schema/schema.rb
@@ -198,6 +198,7 @@ ActiveRecord::Schema.define do
end
create_table :computers, force: true do |t|
+ t.string :system
t.integer :developer, null: false
t.integer :extendedWarranty, null: false
end