diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2019-02-26 21:57:10 -0500 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2019-02-26 21:58:42 -0500 |
commit | 1059dede4c4a1c042e3f4fe9f7fbfcc78146b233 (patch) | |
tree | faac9f9dca234b085fbb4ee5e8c5365ece4e82ab /activerecord/test/models | |
parent | f64043b7cb5b5b2cfdfc8df350437637dcfbd17c (diff) | |
download | rails-1059dede4c4a1c042e3f4fe9f7fbfcc78146b233.tar.gz rails-1059dede4c4a1c042e3f4fe9f7fbfcc78146b233.tar.bz2 rails-1059dede4c4a1c042e3f4fe9f7fbfcc78146b233.zip |
Fix test that was broken by adding a default scope to an existing model
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/author.rb | 7 | ||||
-rw-r--r-- | activerecord/test/models/post.rb | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb index 3eb8a3a0fa..67be59a1fe 100644 --- a/activerecord/test/models/author.rb +++ b/activerecord/test/models/author.rb @@ -217,6 +217,13 @@ class AuthorAddress < ActiveRecord::Base end class AuthorFavorite < ActiveRecord::Base + belongs_to :author + belongs_to :favorite_author, class_name: "Author" +end + +class AuthorFavoriteWithScope < ActiveRecord::Base + self.table_name = "author_favorites" + default_scope { order(id: :asc) } belongs_to :author diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index c6eb77dba4..a83ef983b8 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -78,6 +78,7 @@ class Post < ActiveRecord::Base has_many :comments_with_extend_2, extend: [NamedExtension, NamedExtension2], class_name: "Comment", foreign_key: "post_id" has_many :author_favorites, through: :author + has_many :author_favorites_with_scope, through: :author, class_name: "AuthorFavorite", source: "author_favorites" has_many :author_categorizations, through: :author, source: :categorizations has_many :author_addresses, through: :author has_many :author_address_extra_with_address, |