aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/vehicle_journeys_controller.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb
index 5c24652e5..84500bd0c 100644
--- a/app/controllers/vehicle_journeys_controller.rb
+++ b/app/controllers/vehicle_journeys_controller.rb
@@ -96,6 +96,8 @@ class VehicleJourneysController < ChouetteController
)
end
+ scope = filter_without_time_tables(scope)
+
@q = scope.search filtered_ransack_params
@ppage = 20
@@ -105,6 +107,16 @@ class VehicleJourneysController < ChouetteController
@vehicle_journeys
end
+ def filter_without_time_tables(scope)
+ if params[:q] &&
+ params[:q][:vehicle_journey_without_time_table] == 'false'
+ return scope
+ .exclude_journeys_without_time_tables
+ end
+
+ scope
+ end
+
def filtered_ransack_params
if params[:q]
params[:q] = params[:q].reject{|k| params[:q][k] == 'undefined'}