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