From 7be556fc193c95b0b860ddb7ddd6e476522ff40a Mon Sep 17 00:00:00 2001 From: Dan Ungureanu Date: Wed, 27 Jan 2021 10:43:33 +0200 Subject: [PATCH] FIX: Ensure 'tr' is called on a string. (#11853) It depends on the route, but sometimes 'id' parameter can contain a slug-like value and sometimes it is just an ID. This should work in both cases. --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 53878b0396b..c501ff14472 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -819,7 +819,7 @@ class ApplicationController < ActionController::Base params[:slug] = params[:slug].first if params[:slug].kind_of?(Array) params[:id] = params[:id].first if params[:id].kind_of?(Array) - @slug = (params[:slug].presence || params[:id].presence || "").tr('-', ' ') + @slug = (params[:slug].presence || params[:id].presence || "").to_s.tr('-', ' ') render_to_string status: opts[:status], layout: opts[:layout], formats: [:html], template: '/exceptions/not_found' end