aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/application_model.rb
diff options
context:
space:
mode:
authorZog2018-04-24 09:04:13 +0200
committerJohan Van Ryseghem2018-04-25 15:46:33 +0200
commitc3e6817f2cb2e35c90434574efac256d62636830 (patch)
tree9f73835363786994539c637123366d60013d58d7 /app/models/application_model.rb
parentf838c165685972992d1ee7f597c9d94662099d89 (diff)
downloadchouette-core-c3e6817f2cb2e35c90434574efac256d62636830.tar.bz2
Refs #6669; Fix CustomField initialization
Use the current referential to infer the workgroup
Diffstat (limited to 'app/models/application_model.rb')
-rw-r--r--app/models/application_model.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/application_model.rb b/app/models/application_model.rb
index 1a2a5099d..1715e06c4 100644
--- a/app/models/application_model.rb
+++ b/app/models/application_model.rb
@@ -2,4 +2,20 @@ class ApplicationModel < ::ActiveRecord::Base
include MetadataSupport
self.abstract_class = true
+
+ def self.referential
+ Referential.where(slug: Apartment::Tenant.current).last
+ end
+
+ def referential
+ self.class.referential
+ end
+
+ def self.workgroup
+ referential&.workgroup
+ end
+
+ def workgroup
+ self.class.workgroup
+ end
end