Class: Workarea::Api::Storefront::ProductsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/workarea/api/storefront/products_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#assert_current_metrics_id, #cache_page, #skip_session

Methods included from Authentication

#authentication?, #current_user, find_user

Instance Method Details

#showObject

Raises:

  • (InvalidDisplay)


7
8
9
10
11
12
13
14
15
# File 'app/controllers/workarea/api/storefront/products_controller.rb', line 7

def show
  model = Workarea::Catalog::Product.find_by(slug: params[:id])
  raise InvalidDisplay unless model.active?

  @product = Workarea::Storefront::ProductViewModel.wrap(
    model,
    view_model_options
  )
end