I have a block of this code in my helper:
if !shop.directions.blank?
"<ul>".html_safe +
shop.directions.each do |direction|
"<li>#{direction.direction}</li>".html_safe
end +
"</ul>".html_safe
else
"No directions available.".html_safe
end +
It's showing memory location of direction.direction
like
#<Direction:0xab3c6d0>#<Direction:0xa32c6d0>
instead of the value of it like
1. Take bus no. 3
2. Take train towards Lydia Ave.
Thanks.
UPDATE 1
Now I changed it to this:
spot.directions.flatten.map do |direction|
"<li>".html_safe + direction.direction + "</li>".html_safe
end
using the flatten.map
. But then, it shows the entire code on the browser:
<li>Take bus no. 3</li><li>Take train towards Lydia Ave.</li>
Yes, including the <li><li>