aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/author.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-19 14:14:06 +0100
committerJon Leighton <j@jonathanleighton.com>2010-10-19 14:14:06 +0100
commit01838636c6136d9a649ace71db61bb7990f9bd82 (patch)
tree2f307e4dd6843588ab19f7d41615a04465560fff /activerecord/test/models/author.rb
parent596cc3b2329a9cc4a30c95c157ce36b2d08975df (diff)
downloadrails-01838636c6136d9a649ace71db61bb7990f9bd82.tar.gz
rails-01838636c6136d9a649ace71db61bb7990f9bd82.tar.bz2
rails-01838636c6136d9a649ace71db61bb7990f9bd82.zip
Support for :primary_key option on the source reflection of a through association, where the source is a has_one or has_many
Diffstat (limited to 'activerecord/test/models/author.rb')
-rw-r--r--activerecord/test/models/author.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb
index 1ba01d6b6b..53b3b80950 100644
--- a/activerecord/test/models/author.rb
+++ b/activerecord/test/models/author.rb
@@ -98,12 +98,14 @@ class Author < ActiveRecord::Base
has_one :essay, :primary_key => :name, :as => :writer
has_one :essay_category, :through => :essay, :source => :category
+ has_one :essay_owner, :through => :essay, :source => :owner
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 :essay_owners, :through => :essays, :source => :owner
has_many :essays_2, :primary_key => :name, :class_name => 'Essay', :foreign_key => :author_id
has_many :essay_categories_2, :through => :essays_2, :source => :category