From 4e5f29030ed9fd5262d81b611532bfcaa28fd953 Mon Sep 17 00:00:00 2001 From: Angel Aviel Domaoan Date: Mon, 7 Feb 2022 08:41:05 +0800 Subject: [PATCH] Fix issues using `titleize` --- app/models/cdao/document.rb | 4 ++-- app/models/cdao/jurisprudence.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/cdao/document.rb b/app/models/cdao/document.rb index 315581e..cd9db3a 100644 --- a/app/models/cdao/document.rb +++ b/app/models/cdao/document.rb @@ -30,10 +30,10 @@ class Cdao::Document < Cdao::Base string :reference_number string :title do - (title.present? ? title.first(32760).strip : short_title).titleize + (title.present? ? title.first(32760).strip : short_title || "").titleize end string :short_title do - (short_title.presence || title.first(32760).strip).titleize + (short_title.presence || title || "").first(32760).strip.titleize end date :doc_date diff --git a/app/models/cdao/jurisprudence.rb b/app/models/cdao/jurisprudence.rb index 294b7a5..1cdaa6a 100644 --- a/app/models/cdao/jurisprudence.rb +++ b/app/models/cdao/jurisprudence.rb @@ -77,10 +77,10 @@ class Cdao::Jurisprudence < Cdao::Base string :reference_number string :title do - (title.present? ? title.first(32760).strip : short_title).titleize + (title.present? ? title.first(32760).strip : short_title || "").titleize end string :short_title do - (short_title.presence || title.first(32760).strip).titleize + (short_title.presence || title.first(32760).strip || "").titleize end date :doc_date