Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

How to include HTML Symbols in Erb output tags

Hi Everyone!

I am working on a project that involves some pagination.

My code is below. How do I include html symbols in the Erb output tags.

<h4><%= link_to "Next Page &rarr;", params.merge(page: @projects.next_page), class: "pagination-link next" %></h4>

Regards, Joseph

1 Answer

Im not sure I understand your question. What do you mean by include html symbols in the erb tag. You might be able to pass an html option as an additional parameter using:

html: { class: "whatever" }

Can you clarify what you mean

Hi Stone!

What I mean is how can I include a HTML symbol like → or &nbsp in link_to?

Did you try just putting it inside the link_to string.

Try escaping it with \ and see if that works