- # Map attribute names in @select to real column names, resolve
- # those to fully-qualified SQL column names, and pass the
- # resulting string to the select method.
- api_column_map = model_class.attributes_required_columns
- columns_list = @select.
- flat_map { |attr| api_column_map[attr] }.
- uniq.
- map { |s| "#{table_name}.#{ActiveRecord::Base.connection.quote_column_name s}" }
- @objects = @objects.select(columns_list.join(", "))
+ unless action_name.in? %w(create update destroy)
+ # Map attribute names in @select to real column names, resolve
+ # those to fully-qualified SQL column names, and pass the
+ # resulting string to the select method.
+ api_column_map = model_class.attributes_required_columns
+ columns_list = @select.
+ flat_map { |attr| api_column_map[attr] }.
+ uniq.
+ map { |s| "#{table_name}.#{ActiveRecord::Base.connection.quote_column_name s}" }
+ @objects = @objects.select(columns_list.join(", "))
+ end
+
+ # This information helps clients understand what they're seeing
+ # (Workbench always expects it), but they can't select it explicitly
+ # because it's not an SQL column. Always add it.
+ # (This is harmless, given that clients can deduce what they're
+ # looking at by the returned UUID anyway.)
+ @select |= ["kind"]