aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJon Moss <me@jonathanmoss.me>2017-02-05 16:40:03 -0500
committerGabriel Sobrinho <gabriel.sobrinho@gmail.com>2017-11-13 17:41:28 -0200
commit6acde9578fa55ceab8ef6520bbd5aab2a860d051 (patch)
tree2f1cd46eb75b072937307a667c65812745af97cf /activerecord/lib
parent5cd6f1792e9710979ce53943c28b2b38dae34e98 (diff)
downloadrails-6acde9578fa55ceab8ef6520bbd5aab2a860d051.tar.gz
rails-6acde9578fa55ceab8ef6520bbd5aab2a860d051.tar.bz2
rails-6acde9578fa55ceab8ef6520bbd5aab2a860d051.zip
Do not use `Arel.star` when `ignored_columns`
If there are any ignored columns, we will now list out all columns we want to be returned from the database. Includes a regression test.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index 897ff5c8af..a8800e432a 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -1035,6 +1035,8 @@ module ActiveRecord
def build_select(arel)
if select_values.any?
arel.project(*arel_columns(select_values.uniq))
+ elsif @klass.ignored_columns.any?
+ arel.project(*arel_columns(@klass.column_names))
else
arel.project(table[Arel.star])
end