diff options
Diffstat (limited to 'app/models/query.rb')
-rw-r--r-- | app/models/query.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/app/models/query.rb b/app/models/query.rb index c3d9d56e3..400572eb2 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -208,11 +208,10 @@ class Query < ActiveRecord::Base end def columns - if column_names && !column_names.empty? - available_columns.select {|c| column_names.include?(c.name) } - else - # default columns + if has_default_columns? available_columns.select {|c| c.default? } + else + available_columns.select {|c| column_names.include?(c.name) } end end @@ -225,6 +224,10 @@ class Query < ActiveRecord::Base def has_column?(column) column_names && column_names.include?(column.name) end + + def has_default_columns? + column_names.nil? || column_names.empty? + end def statement # project/subprojects clause |