0
我想在rails中使用youtube的api。Rails 3 gdata网站宽YouTube客户端
我需要一个客户端,它能够访问youtubes API应用程序范围。 所以我写了下面的应用程序控制器
require 'gdata'
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :auth
def auth
@client = GData::Client::YouTube.new
@client.clientlogin('usermail', 'password')
@client
end
end
我能够现在使用的客户端在我的控制器延伸的ApplicationController。 这就是工作正常。 但它很慢。
有没有办法做一次认证,并使用它的应用程序范围内,而不是起诉before_filter,每次调用之前调用一个方法?
最好,
菲利普