Reputation: 32190
I have a method which looks like this
def full
"#{self.first} #{self.second}"
end
problem is that I want to escape it, so to do it in the model I do
def full
ERB::Util.h("#{self.first} #{self.second}")
end
but if first
or second
have &
in it, it would give me &
instead of &
also if they have apostrphies '
it would escape them and make it unreadable..
Is there a way to avoid XSS and make the string readable as well?
Upvotes: 0
Views: 34