Ruby on rails 未定义的方法`触发器';对于推进器:模块

Ruby on rails 未定义的方法`触发器';对于推进器:模块,ruby-on-rails,pusher,Ruby On Rails,Pusher,我才刚开始做推手 在config/initializers/pusher.rb中 require 'pusher' Pusher.app_id = 'xxx' Pusher.key = 'xxx' Pusher.secret = 'xxx' Pusher.logger = Rails.logger Pusher.encrypted = true 在application.html.erb中 // Enable pusher logging - don't include this in pr

我才刚开始做推手

在config/initializers/pusher.rb中

require 'pusher'

Pusher.app_id = 'xxx'
Pusher.key = 'xxx'
Pusher.secret = 'xxx'
Pusher.logger = Rails.logger
Pusher.encrypted = true
在application.html.erb中

// Enable pusher logging - don't include this in production
Pusher.logToConsole = true;

var pusher = new Pusher('xxx', {
  encrypted: true
});

var channel = pusher.subscribe('test_channel');
channel.bind('my_event', function(data) {
  alert(data.message);
});

在控制器中

需要“推动者”

class CheckPushController < ApplicationController
  def show
    Pusher.trigger('test_channel', 'my_event', {
      message: 'hello world'
    })
  end
end

奇怪的是
触发器不起作用!在
config/initializers/pusher.rb
中,请创建一个新实例,而不是使用全局pusher命名空间(已弃用),请参阅导致未初始化的常量pusher::ClientYou始终可以使用Ruby库。巨大的免责声明我是Ably ruby客户端库的作者,所以我认为:)@MatthewO'Riordan我一定会看一看:)奇怪的是,
trigger
不起作用!在
config/initializers/pusher.rb
中,请创建一个新实例,而不是使用全局pusher命名空间(已弃用),请参阅导致未初始化的常量pusher::ClientYou始终可以使用Ruby库。巨大的免责声明我是Ably ruby客户端库的作者,所以我认为:)@MatthewO'Riordan我一定会看看:)
undefined method `trigger' for Pusher:Module