Fix brakeman issue by extracting gsub into a function

This commit is contained in:
Maciej Szlosarczyk 2018-04-26 08:57:28 +03:00
parent a82db7a67a
commit 2c494d9373
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
3 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,5 @@
module ContactHelper
def printable_street(street)
street.to_s.gsub("\n", '<br>').html_safe
end
end

View file

@ -62,7 +62,7 @@
- if contact.street.present?
%dt= t(:street)
%dd{class: changing_css_class(@version,"street")}= contact.street.to_s.gsub("\n", '<br>').html_safe
%dd{class: changing_css_class(@version,"street")}= printable_street(contact.street)
- if contact.city.present?
%dt= t(:city)

View file

@ -8,7 +8,7 @@
%dd= @contact.org_name
%dt= t(:street)
%dd= @contact.street.to_s.gsub("\n", '<br>').html_safe
%dd= printable_street(@contact.street)
%dt= t(:city)
%dd= @contact.city