Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def find_products(products)
- hash_with_products = {}
- products.map do |product|
- product.trait_values.accepted.includes(:trait).where(traits: { inside: false }).order(:trait_id).limit(7).map do |trait_value|
- trait_value.trait.is_obvious_name? ? hash_with_products.store("#{product.id}", "#{trait_value.value}; ") : hash_with_products.store("#{product.id}", "#{trait_value.trait.name}: #{trait_value.value}; ")
- end
- end
- hash_with_products
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement