Class: Workarea::Admin::ReviewViewModel

Inherits:
ApplicationViewModel
  • Object
show all
Defined in:
app/view_models/workarea/admin/review_view_model.rb

Instance Method Summary collapse

Instance Method Details

#nameObject



6
7
8
9
10
11
12
# File 'app/view_models/workarea/admin/review_view_model.rb', line 6

def name
  if product.present?
    t('workarea.admin.reviews.index.review_for', product: product.name)
  else
    t('workarea.admin.reviews.index.review')
  end
end

#productObject



14
15
16
17
18
19
20
# File 'app/view_models/workarea/admin/review_view_model.rb', line 14

def product
  @product ||=
    options[:product] ||
    ProductViewModel.wrap(Catalog::Product.find(product_id))
rescue Mongoid::Errors::DocumentNotFound
  nil
end