I am basically trying to get this result:
<a href="#" class="button small-button green-button">
Log in
<span class="button-right"></span>
</a>
But I don't know how to do this with a link_to in rails 3 ?
I am basically trying to get this result:
<a href="#" class="button small-button green-button">
Log in
<span class="button-right"></span>
</a>
But I don't know how to do this with a link_to in rails 3 ?
The following worked for me. I don't know why other pieces of code didn't (different ruby version?).
To add to Jeremy's answer - for a path, like so:
Your snippet looks like a static link, that will never change when interpreted by Rails; I suppose its save to insert the raw HTML in your view.
However:
Reference.
The simplest way to do it is by using html_safe or raw functions
or using raw function (recommended)
Simple as it can get !!
Don’t use html_safe method unless you’re sure your string isn’t nil. Instead use the raw() method, which wont raise an exception on nil.
You can use the block form of
link_to
for that: