omn​​i auth rails gem ArgumentError

时间:2011-02-25 07:07:21

标签: ruby-on-rails omniauth foursquare

我收到错误消息“ArgumentError - ActionController:Exception Caught”

wrong number of arguments (6 for 5)

lib/omniauth/strategies/foursquare.rb:19:in `initialize'
lib/omniauth/strategies/foursquare.rb:19:in `initialize'

我无法理解6对5参数和我需要修改的内容:

def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block)
client_options = {:site => 'http://foursquare.com'}

auth_path = (options[:sign_in] == false) ? '/oauth/authorize' : '/oauth/authenticate'
auth_path = "/mobile#{auth_path}" if options[:mobile]

client_options[:authorize_path] = auth_path

super(app, :foursquare, consumer_key, consumer_secret, client_options, &block)
end

我的#config / initializers / omniauth.rb包含:

Rails.application.config.middleware.use OmniAuth::Builder do
              provider :foursquare, '[key1]', '[key2]'
 end

我应该修改什么才能获得5个5个参数?这是针对Foursquare Omniauth战略的实施。

1 个答案:

答案 0 :(得分:0)

您对super的来电包含6个参数(:foursquareapp之间的consumer_key是新的)。您继承的类的构造函数应该告诉您要传递的参数。