$('#messages').prepend('<%=j render @message %>') .find('.delete').click(fn) .end().find('.reorder').hover(fn,fn)
If you use something like angular, the whole mess becomes:
$scope.messages.unshift(message);
https://github.com/xpdr/transponder
http://kontax.herokuapp.com/ - example app running on heroku
http://github.com/xpdr/kontax - example app on github
If you use something like angular, the whole mess becomes: