Class: Workarea::Storefront::UserActivityViewModel

Inherits:
ApplicationViewModel
  • Object
show all
Defined in:
app/view_models/workarea/storefront/user_activity_view_model.rb

Instance Method Summary collapse

Instance Method Details

#categoriesObject



15
16
17
18
19
20
21
# File 'app/view_models/workarea/storefront/user_activity_view_model.rb', line 15

def categories
  @categories ||=
    begin
      category_ids = model.viewed.recent_category_ids(max: display_count, unique: true)
      Catalog::Category.find_ordered(category_ids).select(&:active?)
    end
end

#productsObject



4
5
6
7
8
9
10
11
12
13
# File 'app/view_models/workarea/storefront/user_activity_view_model.rb', line 4

def products
  @products ||=
    begin
      product_ids = model.viewed.recent_product_ids(max: display_count, unique: true)

      Catalog::Product.find_ordered(product_ids).select(&:active?).map do |product|
        ProductViewModel.wrap(product, options)
      end
    end
end