I'm using Rails 4 and come across with very strange problem. That raw and truncate not working properly together.
<%= raw(job.description)%> # working properly
<%= raw(truncate(job.description,:length => 200))%> # Not strip html tags
<%= truncate((raw job.description),:length => 200)%> # Not strip html tags
What the problem is?
Any help please??
I'm not sure what you are trying to accomplish so simply try
raw job.description.truncate(200)
and\or
(raw job.description).truncate(200)
You can make use of truncate
with sanitize
truncate(sanitize(job.description, tags: []), length: 200)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With