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...)
Я не понимаю, где я делаю неправильно. Был бы очень признателен за любую помощь