aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb13
1 files changed, 13 insertions, 0 deletions
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