From cacf29a1b4a679e70a017053ed25e0ed7d095d10 Mon Sep 17 00:00:00 2001 From: Thomas Haddad Date: Tue, 11 Apr 2017 12:05:25 +0200 Subject: Refs #3094: Fix select2 in edit display primary and secondary operators Signed-off-by: Thomas Shawarma Haddad --- app/models/chouette/line.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/models/chouette/line.rb') diff --git a/app/models/chouette/line.rb b/app/models/chouette/line.rb index 50dd9b1b3..f44375e7d 100644 --- a/app/models/chouette/line.rb +++ b/app/models/chouette/line.rb @@ -14,6 +14,7 @@ class Chouette::Line < Chouette::ActiveRecord belongs_to :company belongs_to :network + belongs_to :line_referential has_array_of :secondary_companies, class_name: 'Chouette::Company' @@ -75,4 +76,8 @@ class Chouette::Line < Chouette::ActiveRecord [name, company.try(:name)].compact.join(' - ') end + def companies + line_referential.companies.where(id: ([company_id] + Array(secondary_company_ids)).compact) + end + end -- cgit v1.2.3