I have a form that posts a 'thought'. I have it set up to do this using ajax. It basically just appends the thought and the user who posted the thought to the end of the list of thoughts. This worksas expected using this javascript in create.js.erb
$('#thoughts')
.append("<div class='thoughts'><%= @thought.user.name %><p><%= @thought %></p></div>");
but when i try to add a link to the user who posted the thought like so
$('#thoughts')
.append("<div class='thoughts'><%= link_to(@thought.user.name, @thought.user) %><p><%= @thought %></p></div>");
it does append the thought to the list of thoughts. It still posts it to the database but it doesn't display it.
Any help will be much appreciated, thank you.