aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2006-05-22 08:00:05 +0000
committerRick Olson <technoweenie@gmail.com>2006-05-22 08:00:05 +0000
commit213992195d63ca8992676c1c51c276f9801c2d58 (patch)
tree337896709dcc688864c0bc0b7c61bbb26dccb6c6 /activerecord
parentcc1c943aa16d79fde2c13e339da37a1e163061ad (diff)
downloadrails-213992195d63ca8992676c1c51c276f9801c2d58.tar.gz
rails-213992195d63ca8992676c1c51c276f9801c2d58.tar.bz2
rails-213992195d63ca8992676c1c51c276f9801c2d58.zip
Add docs for the :as option in has_one associations. Closes #5144 [cdcarter@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4358 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG2
-rwxr-xr-xactiverecord/lib/active_record/associations.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 044d6e3205..c501af6f44 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Add docs for the :as option in has_one associations. Closes #5144 [cdcarter@gmail.com]
+
* Fixed that has_many collections shouldn't load the entire association to do build or create [DHH]
* Added :allow_nil option for aggregations #5091 [ian.w.white@gmail.com]
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 00ab226db0..3d207aab61 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -586,12 +586,14 @@ module ActiveRecord
# of this class in lower-case and "_id" suffixed. So a +Person+ class that makes a has_one association will use "person_id"
# as the default foreign_key.
# * <tt>:include</tt> - specify second-order associations that should be eager loaded when this object is loaded.
- #
+ # * <tt>:as</tt>: Specifies a polymorphic interface (See #belongs_to).
+ #
# Option examples:
# has_one :credit_card, :dependent => :destroy # destroys the associated credit card
# has_one :credit_card, :dependent => :nullify # updates the associated records foriegn key value to null rather than destroying it
# has_one :last_comment, :class_name => "Comment", :order => "posted_on"
# has_one :project_manager, :class_name => "Person", :conditions => "role = 'project_manager'"
+ # has_one :attachment, :as => :attachable
def has_one(association_id, options = {})
reflection = create_has_one_reflection(association_id, options)