diff options
| author | Alban Peignier | 2018-04-25 09:45:10 +0200 | 
|---|---|---|
| committer | Alban Peignier | 2018-04-25 09:45:10 +0200 | 
| commit | 4a9a0b8842ee297b61ebc9544efb5eb900e44c57 (patch) | |
| tree | ced824064694f64e50e8831caf489eb1160b58a3 | |
| parent | a2c0f14c6a70f8c967ba3e07182f1898b2866edd (diff) | |
| download | chouette-core-4a9a0b8842ee297b61ebc9544efb5eb900e44c57.tar.bz2 | |
Move workgroup method to less global Class (TridentActiveRecord/LineReferentialSupport and StopAreaReferentialSupport) to avoid to overide existing methods. Refs #6669
| -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 | 
