aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-01-01 18:23:06 +0000
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-03 16:24:30 -0800
commitd18a27031f8794b0134645eb0d62ec16653ac537 (patch)
treef10540682a4adb0e8d3181e900ea37abfef053b1 /activerecord/lib/active_record/associations.rb
parent16065b4f19b77111b7fec343969bcf98635e7e27 (diff)
downloadrails-d18a27031f8794b0134645eb0d62ec16653ac537.tar.gz
rails-d18a27031f8794b0134645eb0d62ec16653ac537.tar.bz2
rails-d18a27031f8794b0134645eb0d62ec16653ac537.zip
Add documentation for the :foreign_type option on belongs_to
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rw-r--r--activerecord/lib/active_record/associations.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 9a4f6d4dfd..0c71e76899 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1177,6 +1177,11 @@ module ActiveRecord
# association will use "person_id" as the default <tt>:foreign_key</tt>. Similarly,
# <tt>belongs_to :favorite_person, :class_name => "Person"</tt> will use a foreign key
# of "favorite_person_id".
+ # [:foreign_type]
+ # Specify the column used to store the associated object's type, if this is a polymorphic
+ # association. By default this is guessed to be the name of the association with a "_type"
+ # suffix. So a class that defines a <tt>belongs_to :taggable, :polymorphic => true</tt>
+ # association will use "taggable_type" as the default <tt>:foreign_type</tt>.
# [:primary_key]
# Specify the method that returns the primary key of associated object used for the association.
# By default this is id.