Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

steve98177's Profile

GitHub User: steverjohnston

Comments by steve98177

Avatar

Thanks Ryan! Private_pub really is a Gem. May I suggest a tiny, tiny, three character tweak would make it even more fun:

In app/views/messages/create.js.erb,
Change ".append" to ".prepend", like this:

<% publish_to "/messages/new" do %>
$("#chat").prepend("<%= j render(@message) %>");
<% end %>
$("#new_message")[0].reset();

Restart Mongrel (or your WebServer).

Now, each new micropost will be on top, and you won't have to scroll using the side bar to view it at the bottom.

Avatar

And the problem was: The browser. Works in Firefox 9.0.1. Cheers.

Avatar

Hello Ryan and All,

I have modified the 'before' app according to the section in the example titled 'Using Private Pub in Our Applications' but private pub is failing. I am looking for troubleshooting help.

I am running Rails 3.2.

I do not see a new message appear in the browser until I refresh the screen. The development log looks good. Index.html is being rendered, just not to the browser. Here is the log:

Started GET "/" for 135.209.108.81 at 2012-02-20 15:46:37 -0800
Processing by MessagesController#index as /
Message Load (8.2ms) SELECT messages.* FROM messages
Rendered messages/_message.html.erb (90.4ms)
Rendered messages/index.html.erb within layouts/application (94.5ms)
Completed 200 OK in 132ms (Views: 109.4ms | ActiveRecord: 8.9ms)

Only after I refresh either broswer do I see the chat list. In the log, after the refresh, we see:

Started GET "/assets/application.css?body=1" for 135.209.108.81 at 2012-02-20 15:46:38 -0800
Served asset /application.css - 304 Not Modified (0ms)

Started GET "/assets/messages.css?body=1" for 135.209.108.81 at 2012-02-20 15:46:38 -0800
Served asset /messages.css - 304 Not Modified (0ms)

Beofre I modified the chatter-before app as per the tutorial, the browser submitting the update was updated by ajax. Now, after the modification to use private_pub, the submitting browser must be refreshed to see a new message.

When pointing the browser at the http://myserver:9292, the server responds with the following message:

Sure you're not looking for /faye ?

Thanks. I will post the solution when I know what it is.