From 377ddcd306fb9e61e734aaf3762e05f448938af0 Mon Sep 17 00:00:00 2001 From: Zog Date: Wed, 17 Jan 2018 09:36:15 +0100 Subject: Refs #5586 @1.5h; Migrate more decorators - Remove ApiKeyDecorator (never used) - Migrate CalendarDecorator - Migrate CompanyDecorator - Migrate TimeTableDecorator --- app/controllers/application_controller.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'app/controllers/application_controller.rb') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 80d194096..8bd3da2f9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -52,6 +52,19 @@ class ApplicationController < ActionController::Base 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 -- cgit v1.2.3