我对 Twilio 有一个小问题。我正在尝试发送一条包含用户数据库表上一些数据的短信,以便我可以验证他们是谁。
从用户控制器发送 SMS 。
def verifymobile
@user = User.find(params[:id])
message_to_send = @user.phoneverify
# Instantiate a Twilio client
client = Twilio::REST::Client.new(TWILIO_CONFIG['sid'], TWILIO_CONFIG['token'])
# Create and send an SMS message
client.account.sms.messages.create(
from: TWILIO_CONFIG['from'],
to: @user.cellphone,
body: "Thanks for signing up with Afrocoin. To verify your account,
Please use CODE #{message_to_send}"
)
redirect_to :action => 'index'
end
我在让数据与消息正文 (@user.phoneverify) 一起使用时遇到问题。你能给些建议么