aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/dashboard.rb27
-rw-r--r--app/models/workbench.rb1
2 files changed, 28 insertions, 0 deletions
diff --git a/app/models/dashboard.rb b/app/models/dashboard.rb
new file mode 100644
index 000000000..a53267db5
--- /dev/null
+++ b/app/models/dashboard.rb
@@ -0,0 +1,27 @@
+#
+# The default Dashboard implementation can be customized in an initializer :
+#
+# Rails.application.config.to_prepare do
+# Dashboard.default_class = Custom::Dashboard
+# end
+#
+class Dashboard
+ include ActiveModel::Conversion
+
+ @@default_class = self
+ mattr_accessor :default_class
+
+ attr_reader :context
+
+ def initialize(context)
+ @context = context
+ end
+
+ def self.create(context)
+ default_class.new context
+ end
+
+ def current_organisation
+ context.send(:current_organisation)
+ end
+end
diff --git a/app/models/workbench.rb b/app/models/workbench.rb
index ae111a9c5..c304e8ba9 100644
--- a/app/models/workbench.rb
+++ b/app/models/workbench.rb
@@ -12,6 +12,7 @@ class Workbench < ActiveRecord::Base
has_many :imports
has_many :workbench_imports
has_many :compliance_check_sets
+ has_many :compliance_control_sets
validates :name, presence: true
validates :organisation, presence: true