未初始化的常量控制器:: Yt

时间:2015-09-22 19:41:08

标签: ruby-on-rails ruby-on-rails-4 omniauth

我正在尝试使用YT gem从YouTube检索频道信息,但我一直收到以下错误:

uninitialized constant ChannelsController::Yt

我正在使用Devise和Omniauth Google,当用户登录时,我将他们的访问令牌作为我的from_omniauth方法的一部分保存到数据库中:

def self.from_omniauth(auth)
    where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
      user.provider = auth.provider
      user.uid = auth.uid
      user.email = auth.info.email
      user.password = Devise.friendly_token[0,20]
      user.access_key = auth['credentials']['token']
    end
  end

然后尝试将此传递给YT :: Account.new:

def edit    
    # get youtube account    
    @account = Yt::Account.new access_token: current_user.access_token
    email = @account.email
end

YT安装在我的gem文件中:

gem 'yt', '~> 0.25.5'

我有点不知所措,有什么想法吗?

非常感谢 大卫

0 个答案:

没有答案