Rails link_to doesn't accept inside ruby code -


i have problem rails app. want link

<h1><%= news.title %></h1>  

like this. instead of html tag "a", want use link_to.

<a href="trainers-single.html" class="posttitle"><h1><%= news.title %></h1></a> 

like:

<%= link_to "<h1><%= news.title %></h1>", news, :class => "posttitle" %> 

but doesn't accept it. correct way of showing it?

just use:

<h1><%= link_to news.title, news, :class => "posttitle" %></h1> 

Comments