diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-14 17:40:21 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-14 17:40:21 -0800 |
commit | 4e823b61190388219868744a34dcfe926bad511c (patch) | |
tree | c2896d56720ecf761ee7d6eca8ed23a52b95e60a /activerecord/lib/active_record/relation | |
parent | 494a26d798966a900127d3d4df6bada152896222 (diff) | |
download | rails-4e823b61190388219868744a34dcfe926bad511c.tar.gz rails-4e823b61190388219868744a34dcfe926bad511c.tar.bz2 rails-4e823b61190388219868744a34dcfe926bad511c.zip |
guarantee a list in the alias tracker so we can remove a conditional
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 01d46f7676..7099bdd285 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -347,7 +347,15 @@ module ActiveRecord end def construct_relation_for_association_calculations - apply_join_dependency(self, construct_join_dependency(arel.froms.first)) + from = arel.froms.first + if Arel::Table === from + apply_join_dependency(self, construct_join_dependency) + else + # FIXME: as far as I can tell, `from` will always be an Arel::Table. + # There are no tests that test this branch, but presumably it's + # possible for `from` to be a list? + apply_join_dependency(self, construct_join_dependency(from)) + end end def apply_join_dependency(relation, join_dependency) |