2016-08-21 22 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

我丢弃了分贝,现在一切正常。任何人都可以解释发生了什么?