Class: Spree::PagesController

Inherits:
StoreController
  • Object
show all
Defined in:
app/controllers/spree/pages_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



3
4
5
6
7
8
9
10
11
12
# File 'app/controllers/spree/pages_controller.rb', line 3

def show
  @page =
    if try_spree_current_user&.respond_to?(:has_spree_role?) && try_spree_current_user&.has_spree_role?(:admin)
      Spree::Page.find_by(slug: request.path[1..-1])
    else
      Spree::Page.live.find_by!(slug: request.path[1..-1])
    end

  @title = @page.title
end