diff options
| -rw-r--r-- | app/controllers/lines_controller.rb | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb index bd1550a00..925ac54bf 100644 --- a/app/controllers/lines_controller.rb +++ b/app/controllers/lines_controller.rb @@ -73,20 +73,11 @@ class LinesController < BreadcrumbController end def collection - if params[:q] && params[:q]["network_id_eq"] == "-1" - params[:q]["network_id_eq"] = "" - params[:q]["network_id_blank"] = "1" - end - - if params[:q] && params[:q]["company_id_eq"] == "-1" - params[:q]["company_id_eq"] = "" - params[:q]["company_id_blank"] = "1" - end - - if params[:q] && params[:q]["group_of_lines_id_eq"] == "-1" - params[:q]["group_of_lines_id_eq"] = "" - params[:q]["group_of_lines_id_blank"] = "1" - end + %w(network_id company_id group_of_lines_id comment_id transport_mode_name).each do |filter| + if params[:q] && params[:q]["#{filter}_eq"] == '-1' + params[:q]["#{filter}_eq"] = '' + params[:q]["#{filter}_blank"] = '1' + end @q = line_referential.lines.search(params[:q]) @lines ||= @q.result(:distinct => true).order(:number).paginate(:page => params[:page]).includes([:network, :company]) |
