我正在尝试在 Rails 3 中构建一个 gem,并在其中尝试传递一个初始化程序:
Credentials.configure do |config|
file = File.read("#{Rails.root}/config/twitter.yaml")
file_config = YAML.load(file)
config.consumer_key = file_config[Rails.env][:consumer_key]
config.consumer_secret = file_config[Rails.env][:consumer_secret]
config.callback_url = URI.escape(file_config[Rails.env][:callback_url])
config.time_stamp = Time.now.to_i
end
然后我试图这样称呼它:
Credentials.time_stamp
但我收到此错误:
uninitialized constant Twitter::Credentials
问题是什么?
谢谢