aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/person.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-02-14 23:14:42 +0000
committerJon Leighton <j@jonathanleighton.com>2011-02-18 00:00:13 +0000
commit91fd6510563f84ee473bb217bc63ed598abe3f24 (patch)
tree8d9a4996e5a7b9663e8bd7869d62c9701e5385de /activerecord/test/models/person.rb
parentf0b98050296b57d95dbc789f8e52fa82499d151a (diff)
downloadrails-91fd6510563f84ee473bb217bc63ed598abe3f24.tar.gz
rails-91fd6510563f84ee473bb217bc63ed598abe3f24.tar.bz2
rails-91fd6510563f84ee473bb217bc63ed598abe3f24.zip
Allow building and then later saving has_many :through records, such that the join record is automatically saved too. This requires the :inverse_of option to be set on the source association in the join model. See the CHANGELOG for details. [#4329 state:resolved]
Diffstat (limited to 'activerecord/test/models/person.rb')
-rw-r--r--activerecord/test/models/person.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/models/person.rb b/activerecord/test/models/person.rb
index a18b9e44df..cc3a4f5f9d 100644
--- a/activerecord/test/models/person.rb
+++ b/activerecord/test/models/person.rb
@@ -1,5 +1,7 @@
class Person < ActiveRecord::Base
has_many :readers
+ has_one :reader
+
has_many :posts, :through => :readers
has_many :posts_with_no_comments, :through => :readers, :source => :post, :include => :comments, :conditions => 'comments.id is null'