diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-02-24 16:55:24 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-02-24 16:56:01 -0300 |
commit | c479480638508c20601af69ca46b5b606c2d5b4d (patch) | |
tree | ff42658b68c7cea5dacf94b1160c181e0470080f /activerecord/lib/active_record/relation | |
parent | 2bc72ae29c660a2d9bf6b1b42db4fe18f0d1492f (diff) | |
download | rails-c479480638508c20601af69ca46b5b606c2d5b4d.tar.gz rails-c479480638508c20601af69ca46b5b606c2d5b4d.tar.bz2 rails-c479480638508c20601af69ca46b5b606c2d5b4d.zip |
Merge pull request #18744 from mfazekas/no-table-name-with-from
Fix appending table_name to select and group when used with subquery (fr...
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 7514401072..43b013352b 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -999,11 +999,15 @@ module ActiveRecord end def arel_columns(columns) - columns.map do |field| - if (Symbol === field || String === field) && columns_hash.key?(field.to_s) - arel_table[field] - else - field + if from_value + columns + else + columns.map do |field| + if (Symbol === field || String === field) && columns_hash.key?(field.to_s) + arel_table[field] + else + field + end end end end |