diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2013-05-10 17:41:29 +0200 |
---|---|---|
committer | Ben Woosley <ben.woosley@gmail.com> | 2013-05-10 17:46:04 +0200 |
commit | fba18f19948f084023fd8744025f57da00163265 (patch) | |
tree | 012dcd72d7ab18c92530b203be24b033a73efe19 /activerecord/lib/active_record/associations/join_dependency.rb | |
parent | 35c198ca9bc1ec530fc29b686978511f23cee076 (diff) | |
download | rails-fba18f19948f084023fd8744025f57da00163265.tar.gz rails-fba18f19948f084023fd8744025f57da00163265.tar.bz2 rails-fba18f19948f084023fd8744025f57da00163265.zip |
Extract JoinDependency#join_relation to DRY the repeated application of the #join_associations.
Diffstat (limited to 'activerecord/lib/active_record/associations/join_dependency.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index 28e081c03c..5b2f2d1902 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -55,6 +55,13 @@ module ActiveRecord join_parts.first end + def join_relation(relation) + join_associations.each do |association| + relation = association.join_relation(relation) + end + relation + end + def columns join_parts.collect { |join_part| table = join_part.aliased_table |