diff options
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/author.rb | 2 | ||||
-rw-r--r-- | activerecord/test/models/company.rb | 16 | ||||
-rw-r--r-- | activerecord/test/models/member.rb | 5 |
3 files changed, 17 insertions, 6 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb index 3157d8fe7f..77f4a2ec87 100644 --- a/activerecord/test/models/author.rb +++ b/activerecord/test/models/author.rb @@ -93,8 +93,8 @@ class Author < ActiveRecord::Base has_many :author_favorites has_many :favorite_authors, -> { order('name') }, :through => :author_favorites - has_many :tagging, :through => :posts has_many :taggings, :through => :posts + has_many :taggings_2, :through => :posts, :source => :tagging has_many :tags, :through => :posts has_many :post_categories, :through => :posts, :source => :categories has_many :tagging_tags, :through => :taggings, :source => :tag diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index 5bfbb5e855..75f38d275c 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -115,8 +115,20 @@ class DependentFirm < Company end class RestrictedFirm < Company - has_one :account, -> { order("id") }, :foreign_key => "firm_id", :dependent => :restrict - has_many :companies, -> { order("id") }, :foreign_key => 'client_of', :dependent => :restrict + ActiveSupport::Deprecation.silence do + has_one :account, -> { order("id") }, :foreign_key => "firm_id", :dependent => :restrict + has_many :companies, -> { order("id") }, :foreign_key => 'client_of', :dependent => :restrict + end +end + +class RestrictedWithExceptionFirm < Company + has_one :account, -> { order("id") }, :foreign_key => "firm_id", :dependent => :restrict_with_exception + has_many :companies, -> { order("id") }, :foreign_key => 'client_of', :dependent => :restrict_with_exception +end + +class RestrictedWithErrorFirm < Company + has_one :account, -> { order("id") }, :foreign_key => "firm_id", :dependent => :restrict_with_error + has_many :companies, -> { order("id") }, :foreign_key => 'client_of', :dependent => :restrict_with_error end class Client < Company diff --git a/activerecord/test/models/member.rb b/activerecord/test/models/member.rb index 359b29fac3..1134b09d8b 100644 --- a/activerecord/test/models/member.rb +++ b/activerecord/test/models/member.rb @@ -24,11 +24,10 @@ class Member < ActiveRecord::Base has_one :club_category, :through => :club, :source => :category - has_many :current_memberships - has_one :club_through_many, :through => :current_memberships, :source => :club - has_many :current_memberships, -> { where :favourite => true } has_many :clubs, :through => :current_memberships + + has_one :club_through_many, :through => :current_memberships, :source => :club end class SelfMember < ActiveRecord::Base |