diff options
Diffstat (limited to 'app/controllers/application_controller.rb')
| -rw-r--r-- | app/controllers/application_controller.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 97f5548ae..8bd3da2f9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,7 @@ class ApplicationController < ActionController::Base include PaperTrailSupport include Pundit + include FeatureChecker rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized @@ -40,12 +41,30 @@ class ApplicationController < ActionController::Base end helper_method :current_offer_workbench + def current_workgroup + current_offer_workbench.workgroup + end + helper_method :current_workgroup + def current_functional_scope functional_scope = current_organisation.sso_attributes.try(:[], "functional_scope") if current_organisation JSON.parse(functional_scope) if functional_scope end helper_method :current_functional_scope + def collection_name + self.class.name.split("::").last.gsub('Controller', '').underscore + end + + def decorated_collection + if instance_variable_defined?("@#{collection_name}") + instance_variable_get("@#{collection_name}") + else + nil + end + end + helper_method :decorated_collection + def begin_of_association_chain current_organisation end |
