1

I'm pretty new to Rails templates.

Here's my current code:

<li><%= link_to "Home", "/path1" %></li>

Here's how I'd like the code to work:

          <li><a href="path1"><i class="icon-home icon-white icon-active"></i> Home</a></li>

I have tried with no avail to figure this out. Basically I just want an embedded tag.

1 Answer 1

6

you can pass a block to link_to:

<li>
<%= link_to "/path1" do %>
  <i class="icon-home icon-white icon-active"></i> Home</a>
<% end %>
</li>
Sign up to request clarification or add additional context in comments.

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.