Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.48 KB | None | 0 0
  1.   def find_products(products)
  2.     hash_with_products = {}
  3.  
  4.     products.map do |product|
  5.       product.trait_values.accepted.includes(:trait).where(traits: { inside: false }).order(:trait_id).limit(7).map do |trait_value|
  6.         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}; ")
  7.       end
  8.     end
  9.  
  10.     hash_with_products
  11.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement