Sign in through GitHub

RailsCasts Pro episodes are now free!

Learn more or hide this

menisy's Profile

GitHub User: menisy

Comments by


even better,

<% publish_to "/messages/new" do %>
$("#chat").append("<%= escape_javascript render(@message) %>");
$("#chat").animate({ scrollTop: $("#chat").height() }, "fast");
<% end %>

This second line makes sure that the scroll is animated to the bottom so that it shows the newly appended message!