RailsCasts Pro episodes are now free!

Learn more or hide this

buhrmi's Profile

GitHub User: buhrmi

Comments by

Avatar

With a small little DSL that transforms into Javascript: https://github.com/buhrmi/rbjs

The code I wrote above, however, contains a bug that would reset the input field for all users.

Avatar

Nice episode. I did the same few days ago using PusherApp together with Rbjs. It cleans up the Serverside Javascript pretty much and I ended up simply writing:

ruby
class MessageController < ApplicationController
  def message
    # some logic here
    publish_to @message.channel do
      jQuery('#messages').append render @message
      jQuery('#new_message_text').val '' if @message.user_id == current_user_id
    end
  end
end