Hi,
I want to display the number of comments for a post in a link_to. So
the link will look like below.
Comments(3)
How do i build this string in the link_to. I get an error about trying
to convert a fixnum to a string see code below.
<% case post.comments.size
when 0 %>
No Comments
<% else %>
<%= link_to ‘Comments(’ + post.comments.size + ‘)’, :action
=> ‘show’, :id => post %>
<% end %>
On another note. Would it be better to seperate this code into a
controller returning a string saying No Comments/Comments(x) incase i
needed it in more than 1 place?