diff options
| author | Alban Peignier | 2016-11-28 10:53:24 +0100 |
|---|---|---|
| committer | Alban Peignier | 2016-11-28 11:03:34 +0100 |
| commit | 6acd65bbda4bf95d6c7a7218b390deba86a6aedb (patch) | |
| tree | d0d80c6eb634c52eadf81fcaf170f194b37b7a97 /app/controllers | |
| parent | 9b3db9a441533b159723f31f72e13322894ca30a (diff) | |
| download | chouette-core-6acd65bbda4bf95d6c7a7218b390deba86a6aedb.tar.bz2 | |
Define Route candidate_opposite_routes in RoutesController to fix loading in referentials#new. Refs #2052
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/routes_controller.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb index a7e8e32a6..aecdb480d 100644 --- a/app/controllers/routes_controller.rb +++ b/app/controllers/routes_controller.rb @@ -9,6 +9,8 @@ class RoutesController < ChouetteController belongs_to :line, :parent_class => Chouette::Line, :optional => true, :polymorphic => true end + before_action :define_candidate_opposite_routes, only: [:new, :edit, :create, :update] + def index index! do |format| format.html { redirect_to referential_line_path(@referential,@line) } @@ -74,6 +76,15 @@ class RoutesController < ChouetteController end end + def define_candidate_opposite_routes + @candidate_opposite_routes = + if params[:id] + resource.line.routes.where("id <> ?", resource) + else + parent.routes + end + end + private def route_params @@ -81,4 +92,3 @@ class RoutesController < ChouetteController end end - |
