diff options
author | Jack Danger Canty <git@6brand.com> | 2008-05-06 23:35:05 -0700 |
---|---|---|
committer | Jack Danger Canty <git@6brand.com> | 2008-05-06 23:35:05 -0700 |
commit | f81d771f0657ae8375b84a77a059812cce5d6fd9 (patch) | |
tree | c6ab94c9654dcdcd2ac0ce8e727352c1a3aeaad6 /activerecord | |
parent | 405de50af0b4bf4b2f34a3e6f27e9f3aa5e04eb7 (diff) | |
download | rails-f81d771f0657ae8375b84a77a059812cce5d6fd9.tar.gz rails-f81d771f0657ae8375b84a77a059812cce5d6fd9.tar.bz2 rails-f81d771f0657ae8375b84a77a059812cce5d6fd9.zip |
doc: ActiveRecord::Reflection::AssociationReflection#through_reflection
Added documentation demonstrating the use of #through_reflection for
finding intervening reflection objects for HasManyThrough
and HasOneThrough.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 61005af83f..811e53c428 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 HasMantThrough 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 |