1

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 %>
1
  • Solved my problem <% link_to portfolio_path do %> Portfolio <span>Our work</span> <% end %> Commented Sep 15, 2010 at 21:08

2 Answers 2

3

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 %>
Sign up to request clarification or add additional context in comments.

1 Comment

The first method doesn't quite work. But the second method exactly did the job. Thanks again.
1

You can try something like this:


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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.