Skip to content

Commit e357cd2

Browse files
Fix html entities decoding
1 parent b992d8d commit e357cd2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/models/chapter.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Chapter < ApplicationRecord
55
has_many :manpower_surveys
66
validates_presence_of :name
77

8-
before_save :normalize_field
8+
before_save :normalize_fields
99

1010
default_scope { order(chapter_roll: :asc) }
1111
scope :active, -> { where(status: 1) }
@@ -94,9 +94,12 @@ class Chapter < ApplicationRecord
9494
'Omega' => '&#937;'
9595
}.freeze
9696

97-
def normalize_field
97+
def normalize_fields
9898
return unless institution_name.present?
9999

100+
# Decode HTML entities
101+
institution_name.replace(CGI.unescapeHTML(institution_name))
102+
100103
institution_name.gsub!(' Of ', ' of ')
101104
institution_name.gsub!(' At ', ' at ')
102105
institution_name.gsub!(' And ', ' and ')

0 commit comments

Comments
 (0)