aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/referential.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/referential.rb')
-rw-r--r--app/models/referential.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/referential.rb b/app/models/referential.rb
index 1e2c2acc3..8b8df3294 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -30,7 +30,7 @@ class Referential < ActiveRecord::Base
validates_presence_of :line_referential
belongs_to :created_from, class_name: 'Referential'
- has_many :lines, through: :line_referential
+ has_many :associated_lines, through: :line_referential, source: :lines
has_many :companies, through: :line_referential
has_many :group_of_lines, through: :line_referential
has_many :networks, through: :line_referential
@@ -43,6 +43,10 @@ class Referential < ActiveRecord::Base
has_many :stop_areas, through: :stop_area_referential
belongs_to :workbench
+ def lines
+ workbench ? workbench.lines : associated_lines
+ end
+
def slug_excluded_values
if ! slug.nil?
if slug.start_with? "pg_"