method
build_select
v3.0.0 -
Show latest stable
- Class:
ActiveRecord::QueryMethods
build_select(arel, selects)private
No documentation available.
# File activerecord/lib/active_record/relation/query_methods.rb, line 223
def build_select(arel, selects)
unless selects.empty?
@implicit_readonly = false
# TODO: fix this ugly hack, we should refactor the callers to get an ARel compatible array.
# Before this change we were passing to ARel the last element only, and ARel is capable of handling an array
if selects.all? {|s| s.is_a?(String) || !s.is_a?(Arel::Expression) } && !(selects.last =~ /^COUNT\(/)
arel.project(*selects)
else
arel.project(selects.last)
end
else
arel.project(Arel::SqlLiteral.new(@klass.quoted_table_name + '.*'))
end
end