RoR
RoR

Reputation: 16472

HTML Rails View Format Question

How would I produce something like this in Rails ERB?

<li><a href="portfolio.html">Portfolio <span>Our work</span></a>

My problem is that ruby won't allow me to span inside of the link.

<%= link_to 'portfolio', portfolio_path %>

Anyway to get the Our Works Span inside of that link?

Thanks in Advance.

Solved

<% link_to portfolio_path do %> Portfolio <span>Our work</span> <% end %>

Upvotes: 1

Views: 172

Answers (2)

Punit Rathore
Punit Rathore

Reputation: 970

You can try something like this:


<%= link_to 'Porfolio <span>Our Work</span>', portfolio_path %>

Upvotes: 1

Andrew Vit
Andrew Vit

Reputation: 19239

You could put the HTML string right in there like this:

<%= link_to 'Portfolio <span>Our work</span>', portfolio_path %>

Or, you can pass a block to enclose the link:

<% link_to portfolio_path do %>
Portfolio <span>Our work</span>
<% end %>

Upvotes: 3

Related Questions