我对Twilio有一个小问题。我正在尝试发送一些短信 用户数据库表上的数据,以便我可以验证他们是谁。
来自用户控制器的 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)获取数据时遇到问题。你能告诉我吗
答案 0 :(得分:0)
您确定@user和@ user.phoneverify有效值吗?