aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/author.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-19 12:47:19 +0100
committerJon Leighton <j@jonathanleighton.com>2010-10-19 12:47:19 +0100
commit596cc3b2329a9cc4a30c95c157ce36b2d08975df (patch)
tree2a67f6a9270bb528ad5df8bc805f2ef121e93858 /activerecord/test/models/author.rb
parent9ec07348749675110843c44f680da79223218db2 (diff)
downloadrails-596cc3b2329a9cc4a30c95c157ce36b2d08975df.tar.gz
rails-596cc3b2329a9cc4a30c95c157ce36b2d08975df.tar.bz2
rails-596cc3b2329a9cc4a30c95c157ce36b2d08975df.zip
Respect the :primary_key option on the through_reflection of (non-nested) through associations
Diffstat (limited to 'activerecord/test/models/author.rb')
-rw-r--r--activerecord/test/models/author.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb
index c0e082836d..1ba01d6b6b 100644
--- a/activerecord/test/models/author.rb
+++ b/activerecord/test/models/author.rb
@@ -95,8 +95,18 @@ class Author < ActiveRecord::Base
has_many :subscriptions, :through => :books
has_many :subscribers, :through => :subscriptions, :order => "subscribers.nick" # through has_many :through (on through reflection)
has_many :distinct_subscribers, :through => :subscriptions, :source => :subscriber, :select => "DISTINCT subscribers.*", :order => "subscribers.nick"
-
+
has_one :essay, :primary_key => :name, :as => :writer
+ has_one :essay_category, :through => :essay, :source => :category
+
+ has_one :essay_2, :primary_key => :name, :class_name => 'Essay', :foreign_key => :author_id
+ has_one :essay_category_2, :through => :essay_2, :source => :category
+
+ has_many :essays, :primary_key => :name, :as => :writer
+ has_many :essay_categories, :through => :essays, :source => :category
+
+ has_many :essays_2, :primary_key => :name, :class_name => 'Essay', :foreign_key => :author_id
+ has_many :essay_categories_2, :through => :essays_2, :source => :category
belongs_to :author_address, :dependent => :destroy
belongs_to :author_address_extra, :dependent => :delete, :class_name => "AuthorAddress"