Class: Workarea::Api::Storefront::MenusController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/workarea/api/storefront/menus_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

#indexObject



7
8
9
10
# File 'app/controllers/workarea/api/storefront/menus_controller.rb', line 7

def index
  models = Navigation::Menu.all.select(&:active?)
  @menus = Workarea::Storefront::MenuViewModel.wrap(models, params)
end

#showObject

Raises:

  • (InvalidDisplay)


12
13
14
15
16
17
# File 'app/controllers/workarea/api/storefront/menus_controller.rb', line 12

def show
  model = Navigation::Menu.find(params[:id])
  raise InvalidDisplay unless model.active?

  @menu = Workarea::Storefront::MenuViewModel.wrap(model, params)
end