aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/reflection.rb
diff options
context:
space:
mode:
authorrick <rick@spacemonkey.local>2008-05-10 17:46:55 -0700
committerrick <rick@spacemonkey.local>2008-05-10 17:46:55 -0700
commitd09a8446d5606a5a0b5c024224b09a1318e9cf4d (patch)
tree199ef3554f731c980ea5726e67e34af4ea057c2e /activerecord/lib/active_record/reflection.rb
parentc8451aeeea200043d8a3e6eae9c49def3a154ddb (diff)
parenta7ea06b4ebe252e258f83e7de945b4baa30ec3bc (diff)
downloadrails-d09a8446d5606a5a0b5c024224b09a1318e9cf4d.tar.gz
rails-d09a8446d5606a5a0b5c024224b09a1318e9cf4d.tar.bz2
rails-d09a8446d5606a5a0b5c024224b09a1318e9cf4d.zip
fix merge conflict with actionpack changelog
Diffstat (limited to 'activerecord/lib/active_record/reflection.rb')
-rw-r--r--activerecord/lib/active_record/reflection.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index 61005af83f..8614ef8751 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -153,6 +153,17 @@ module ActiveRecord
end
end
+ # Returns the AssociationReflection object specified in the <tt>:through</tt> option
+ # of a HasManyThrough or HasOneThrough association. Example:
+ #
+ # class Post < ActiveRecord::Base
+ # has_many :taggings
+ # has_many :tags, :through => :taggings
+ # end
+ #
+ # tags_reflection = Post.reflect_on_association(:tags)
+ # taggings_reflection = tags_reflection.through_reflection
+ #
def through_reflection
@through_reflection ||= options[:through] ? active_record.reflect_on_association(options[:through]) : false
end
@@ -168,7 +179,8 @@ module ActiveRecord
# Gets the source of the through reflection. It checks both a singularized and pluralized form for <tt>:belongs_to</tt> or <tt>:has_many</tt>.
# (The <tt>:tags</tt> association on Tagging below.)
#
- # class Post
+ # class Post < ActiveRecord::Base
+ # has_many :taggings
# has_many :tags, :through => :taggings
# end
#