【发布时间】:2015-02-03 21:50:15
【问题描述】:
我不断收到uninitialized constant Twilio::Rest 错误,无法弄清楚我做错了什么。我的代码如下。
表盘型号
require 'twilio-ruby'
class Dial < ActiveRecord::Base
before_create :send_call
private
def send_call
#begin
account_sid = 'sid'
account_auth_token = 'auth'
caller = '+14693514939'
numbers = Number.find_by_sql('select phone from numbers')
@client = ::Twilio::Rest::Client.new account_sid, account_auth_token
numbers.each do |dial|
@client.account.calls.create(
:from => caller,
:to => dial,
:url => 'http://twimlets.com/echo?Twiml=hello%20this%20is%20a%20test%20call%20please%20hang%20up&')
end
#rescue
#false
#end
end
end
我的表盘视图
<%= button_to "Call", action: "create" %>
有什么想法吗?
【问题讨论】:
标签: ruby-on-rails ruby activerecord twilio