I have Book.description with the following stored in the database:
aaa
bbb
test
fsdfdsfs fds fd sf sdf ds
I need to display the above including the line breaks in my view page.
I tried <%= @book.description.gsub(/\n/, '<br />')%> but I am getting the following error message :
private method `gsub' called for #<Hash:0xb662aa50>
I also tried <%= @book.description.html_safe%> but am getting the error message below:
undefined method `html_safe' for #<Hash:0xb66625f4>
Any suggestion ragarding this issue is most appreciated.
@book.description.to_sto the question, to inspect its real content?gsubandhtml_safeobviously will not work on it. If the hash values are the strings you showed, you'll have to collect them first and then joining them with a BR tag will work.