views:

29

answers:

2

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 %>
+2  A: 

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 %>
Andrew Vit
The first method doesn't quite work. But the second method exactly did the job. Thanks again.
RoR
+1  A: 
punit