aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2017-05-30 18:08:22 +0930
committerMatthew Draper <matthew@trebex.net>2017-05-30 18:20:58 +0930
commit75226cc7d8224762932d4f5593ea366f25cbf61e (patch)
tree97ad5d4e90083b612037de88d362679f38ebad64 /activerecord/test/models
parent6847877a30fd8d578f72db0cf40674f71a9b6286 (diff)
parent5632f73042bc543d59e6f3e913e0d2cd44b54a65 (diff)
downloadrails-75226cc7d8224762932d4f5593ea366f25cbf61e.tar.gz
rails-75226cc7d8224762932d4f5593ea366f25cbf61e.tar.bz2
rails-75226cc7d8224762932d4f5593ea366f25cbf61e.zip
Merge pull request #29098 from kamipo/fix_association_with_extension_issues
Fix association with extension issues
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/comment.rb10
-rw-r--r--activerecord/test/models/post.rb2
2 files changed, 11 insertions, 1 deletions
diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb
index 76b484e616..8cba788598 100644
--- a/activerecord/test/models/comment.rb
+++ b/activerecord/test/models/comment.rb
@@ -19,6 +19,16 @@ class Comment < ActiveRecord::Base
has_many :children, class_name: "Comment", foreign_key: :parent_id
belongs_to :parent, class_name: "Comment", counter_cache: :children_count
+ class ::OopsError < RuntimeError; end
+
+ module OopsExtension
+ def destroy_all(*)
+ raise OopsError
+ end
+ end
+
+ default_scope { extending OopsExtension }
+
# Should not be called if extending modules that having the method exists on an association.
def self.greeting
raise
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index a2028b3eb9..4c913b3b72 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -13,7 +13,7 @@ class Post < ActiveRecord::Base
module NamedExtension2
def greeting
- "hello"
+ "hullo"
end
end