Class: Cdx::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
ControllerHelpers::Seo, ControllerHelpers::Settings
Defined in:
app/controllers/cdx/application_controller.rb

Direct Known Subclasses

Cdx::Admin::BaseController, StaticController

Instance Method Summary collapse

Methods included from ControllerHelpers::Settings

#current_settings

Methods included from ControllerHelpers::Seo

#canonical_url, #contextual_record, #meta_data, #meta_title, #open_graph_data

Instance Method Details

#current_abilityObject



8
9
10
11
12
13
14
15
16
# File 'app/controllers/cdx/application_controller.rb', line 8

def current_ability
  if try(:current_user)
    controller_name_segments = params[:controller].split('/')
    controller_name_segments.pop
    controller_namespace = controller_name_segments.join('/').camelize

    @current_ability ||= Ability.new(current_user, controller_namespace, Cdx::Site.current)
  end
end