In my view I would like to have Post.find.. before the raw as in the second example below. The raw is there because I’m using a separate font inline that I need to detect with css.
Putting the raw before the Post: this renders properly. However it’s not the sequence I want.
<%= link_to raw("<span id='arrow'>></span>") + Post.find_by_id(post.id-1).title, params.merge(:page => @posts.previous_page) %>
This doesn’t work, the raw gets rendered like, "<span id='arrow'>></span>". But it is the sequence I want.
<%= link_to Post.find_by_id(post.id-1).title + raw("<span id='arrow'>></span>"), params.merge(:page => @posts.previous_page) %>
How can I get the second statement to render the raw properly?
1 Answer