I'm trying to implement Pusher to my rails app and have it working in principal however I am struggling to add ruby code to the string of data being pushed to the client to create a url using link_to. I'm struggling to understand the problem as the javascript console is saying:
Uncaught SyntaxError: Unexpected token %
<script src="http://js.pusher.com/2.2/pusher.min.js"></script>
<script type="text/javascript">
var pusher = new Pusher('<%= Pusher.key %>'); // uses your API KEY
var channel = pusher.subscribe('worklink');
channel.bind('update', function(data) {
$("#comments").prepend(
"<div class='post_box'><div class='post'><p class='username'><b><%= link_to " + data.userfirstname + " " + data.userlastname + ", user_path(" + data.userid + ") %></b></p><p class='post_content'>" + data.postcontent + "</p></div></div>");
});
</script>
Any help would be much appreciated.