diff options
| author | Alban Peignier | 2018-04-25 09:45:10 +0200 |
|---|---|---|
| committer | Johan Van Ryseghem | 2018-04-25 15:46:33 +0200 |
| commit | 199e4eaeffe8a826f5215359494ba3cc6ac6eb8a (patch) | |
| tree | 44ce5e0def40537ff1faf7bd97ebc1545ef24144 /app | |
| parent | 2272a75da51315c5ec702a293438796c0f88ccbb (diff) | |
| download | chouette-core-199e4eaeffe8a826f5215359494ba3cc6ac6eb8a.tar.bz2 | |
Move workgroup method to less global Class (TridentActiveRecord/LineReferentialSupport and StopAreaReferentialSupport) to avoid to overide existing methods. Refs #6669
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/application_model.rb | 16 | ||||
| -rw-r--r-- | app/models/chouette/trident_active_record.rb | 7 | ||||
| -rw-r--r-- | app/models/concerns/line_referential_support.rb | 4 | ||||
| -rw-r--r-- | app/models/concerns/stop_area_referential_support.rb | 4 |
4 files changed, 14 insertions, 17 deletions
diff --git a/app/models/application_model.rb b/app/models/application_model.rb index 1715e06c4..1a2a5099d 100644 --- a/app/models/application_model.rb +++ b/app/models/application_model.rb @@ -2,20 +2,4 @@ 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 diff --git a/app/models/chouette/trident_active_record.rb b/app/models/chouette/trident_active_record.rb index 18b7bbf9b..7e5140fc4 100644 --- a/app/models/chouette/trident_active_record.rb +++ b/app/models/chouette/trident_active_record.rb @@ -7,6 +7,11 @@ module Chouette @referential ||= Referential.where(:slug => Apartment::Tenant.current).first! end + def workgroup + referential&.workgroup + end + + def hub_restricted? referential.data_format == "hub" end @@ -16,4 +21,4 @@ module Chouette end end -end
\ No newline at end of file +end diff --git a/app/models/concerns/line_referential_support.rb b/app/models/concerns/line_referential_support.rb index 5eade3557..b77a178eb 100644 --- a/app/models/concerns/line_referential_support.rb +++ b/app/models/concerns/line_referential_support.rb @@ -7,6 +7,10 @@ module LineReferentialSupport alias_method :referential, :line_referential end + def workgroup + line_referential&.workgroup + end + def hub_restricted? false end diff --git a/app/models/concerns/stop_area_referential_support.rb b/app/models/concerns/stop_area_referential_support.rb index f29397b3a..fb9edd7d5 100644 --- a/app/models/concerns/stop_area_referential_support.rb +++ b/app/models/concerns/stop_area_referential_support.rb @@ -7,6 +7,10 @@ module StopAreaReferentialSupport alias_method :referential, :stop_area_referential end + def workgroup + stop_area_referential&.workgroup + end + def hub_restricted? false end |
