2016-08-21 43 views
1

連接中斷,我有一個PubSub的訂閱這裏PubSub的,而該頁面被loadibng錯誤

ul.questions_list 
-if(@questions.empty?) 
    |no questions available 
-else 
    [email protected] do|question| 
    li 
     =link_to"#{ question.title } ", question_path(question)  

p= link_to 'Ask question', new_question_path 
= subscribe_to '/questions' 

然後去咖啡(在這種情況下的console.log給出正確的數據)

$ -> 
    PrivatePub.subscribe '/questions', (data, channel) -> 
    question = $.parseJSON(data['question']) 
    console.log(question.title) 
    $('.questions_list').append("<li><a href='/questions/#{question.id}'>#{question.title}</a></li>"); 

和控制器

def create 
    @question = Question.new(question_params) 
    @question.user = current_user 
    if @question.save 
     PrivatePub.publish_to '/questions', question: @question.to_json 
     redirect_to @question, notice: 'Your question successfully created.' 
    else 
     render :new 
    end 
    end 

我收到這樣的錯誤

The connection to ws://localhost:9292/faye was interruped while the page was loading. 
...et;t.exports={create:function(t){return **new** n(t)}}}).call(e.function(){return th...) 

我不明白我在哪裏做錯了。將非常感謝任何幫助

回答

0

我丟棄了分貝,現在一切正常。任何人都可以解釋發生了什麼?