aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/chouette/line.rb
diff options
context:
space:
mode:
authorThomas Haddad2017-04-11 12:05:25 +0200
committerThomas Haddad2017-04-11 12:06:06 +0200
commitcacf29a1b4a679e70a017053ed25e0ed7d095d10 (patch)
tree9a35523ca563591f86dc78fe8a95ac4e18226009 /app/models/chouette/line.rb
parentb23f6dca2395d87e2a3c0f8d8ca15303b240aef7 (diff)
downloadchouette-core-cacf29a1b4a679e70a017053ed25e0ed7d095d10.tar.bz2
Refs #3094: Fix select2 in edit display primary and secondary operators
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
Diffstat (limited to 'app/models/chouette/line.rb')
-rw-r--r--app/models/chouette/line.rb5
1 files changed, 5 insertions, 0 deletions
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