Is there any advantage to using link_to over the anchor tag in Rails?

Don't these two do the same?

<%= link_to "Example", '#', class: "somestyle" %>

<a href="#" class= "somestyle"> Example </a>

If I write a static .html.erb page, if everything else is written using HTML tags, does it make sense to also use HTML tags for links? I do not know why you need to use an assistant. Similarly, for linking stylesheets, javascripts, etc.

+4
source share
1 answer

For link tags, this may not affect how you go. If you do not contact with more than "#". For example, using a routable path.

javascript, , Rails, . , ( ), .

+4

Source: https://habr.com/ru/post/1530652/


All Articles