mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
8 lines
395 B
Ruby
8 lines
395 B
Ruby
page_type = Vehicle
|
|
field = 'Type of vehicle'
|
|
|
|
cats = AttributeCategory.where(entity_type: page_type.name.downcase, label: 'Overview').pluck(:id)
|
|
fs = AttributeField.where(attribute_category_id: cats, label: field).pluck(:id)
|
|
|
|
Attribute.where(attribute_field_id: fs).where.not(value: [nil, ""]).group(:value).order('count_id DESC').limit(100).count(:id).keys.map { |k| k.downcase.strip }.sort
|