aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/reader.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/reader.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/reader.rb')
-rw-r--r--activerecord/test/models/reader.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/test/models/reader.rb b/activerecord/test/models/reader.rb
index 27527bf566..0207a2bd92 100644
--- a/activerecord/test/models/reader.rb
+++ b/activerecord/test/models/reader.rb
@@ -1,4 +1,5 @@
class Reader < ActiveRecord::Base
belongs_to :post
- belongs_to :person
+ belongs_to :person, :inverse_of => :readers
+ belongs_to :single_person, :class_name => 'Person', :foreign_key => :person_id, :inverse_of => :reader
end