Note that there are some explanatory texts on larger screens.

plurals
  1. POPubnub and Rails 4
    primarykey
    data
    text
    <p>I'm following a twitter tutorial for a class project and I'm stuck at the part where the tutorial is using PUBNUB. I'm getting the following error:</p> <pre><code>Showing C:/RubyProjects/twitter/app/views/layouts/application.html.erb where line #93 raised: **wrong number of arguments(1 for 0)** Extracted source (around line #93): PUBNUB.subscribe({ channel : "&lt;%= Digest::SHA1.hexdigest(current_user.username, current_user.created_at) %&gt;", callback : function(message) { updateTimeline(message) } </code></pre> <p>I found on stackoverflow and found that EventMachine helped some folks and I tried that but still nada :(</p> <p>I checked the PUBNUB page on Github and saw that it has changed the way <strong>channel</strong> and <strong>callback</strong> was written so I tried doing that but it did not help either. Im still getting the same error about wrong number of arguments(1 for 0).</p> <p>Notify.rb</p> <pre><code>class Notify def self.deliver_message_to_user(params) post = Post.find(params[:post_id]) user = User.find(params[:user_id]) user.channel ||= Channel.new( :channel_ident =&gt; Digest::SHA1.hexdigest(user.username, user.created_at.to_s)) Pubnub.publish({ :channel =&gt; user.channel.channel_ident, :message =&gt; post.to_json(:include =&gt; :user) }) end end </code></pre> <p>application.html.erb</p> <pre><code>&lt;script&gt; function updateTimeline(message) { var html = JST['post'](jQuery.parseJSON(message)); $('#timeline').prepend(html); } Pubnub.subscribe({ :channel =&gt; "&lt;%= Digest::SHA1.hexdigest(current_user.username, current_user.created_at) %&gt;", :callback =&gt; function(message) { updateTimeline(message) } }) &lt;/script&gt; </code></pre> <p>I put <strong>require 'digest'</strong> in my application.rb file and it still din't help. Could it be the syntax? If it is, i'm not sure what the correct syntax would be.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload