How to use link tag in ruby on rails?
<% link_to "Stephen Weber", "home.html" %>
How to use link tag in ruby on rails?
<% link_to "Stephen Weber", "home.html" %>
You have missed =
, its should be <%=
<%= link_to "Stephen Weber", "home.html" %>
It depends on the type of view renderer engine you are using, if you are using Haml-rails then syntax is slightly different, remember that Haml views are indentation based just like python :
= link_to "Stephen Weber", "Home.html", {class: 'any_class_name', id: 'try_to_use_unique', style: 'margin:'''}
If you are using erb, then syntax is:
<%= link_to "Stephen Weber", "Home.html", {class: 'any_class_name', id: 'try_to_use_unique', style: 'margin:'''} %>
You have missed =
in
<% link_to "Stephen Weber", "home.html" %>
It should be
<%= link_to "Stephen Weber", "home.html" %>
For more details on Rails ERB format, go to Why many people use "-%>" instead of "%>" in Rails?