Class: Workarea::Admin::Reports::WishListProductsViewModel
- Inherits:
-
ApplicationViewModel
- Object
- ApplicationViewModel
- Workarea::Admin::Reports::WishListProductsViewModel
- Defined in:
- app/view_models/workarea/admin/reports/wish_list_products_view_model.rb
Instance Method Summary collapse
Instance Method Details
#products ⇒ Object
12 13 14 15 16 |
# File 'app/view_models/workarea/admin/reports/wish_list_products_view_model.rb', line 12 def products @products ||= Catalog::Product.any_in( id: model.results.map { |r| r['_id'] } ).to_a end |
#results ⇒ Object
5 6 7 8 9 10 |
# File 'app/view_models/workarea/admin/reports/wish_list_products_view_model.rb', line 5 def results @results ||= model.results.map do |result| product = products.detect { |p| p.id == result['_id'] } OpenStruct.new({ product: product }.merge(result)) end end |