Reputation: 161
Don't these two do the same thing?
<%= link_to "Example", '#', class: "somestyle" %>
<a href="#" class= "somestyle"> Example </a>
If I'm writing a static .html.erb page, if everything else is written with HTML tags, doesn't it make sense to use HTML tags for links as well? I'm not sure why one should use a helper. Similarly, for linking style sheets, javascripts, etc.
Upvotes: 6
Views: 1474
Reputation: 3697
For the link tags, it may not make a difference which way you go. Unless you're linking to more than "#". For instance, using a routed path.
For the stylesheets and javascript, I think you will need to continue to use the Rails helpers if you're taking advantage of the asset pipeline. If so, the hash in the filename changes at each asset compilation (I believe), and manually trying to edit the filename each time could become a pain.
Upvotes: 5