【发布时间】:2017-09-12 15:26:50
【问题描述】:
我正在尝试从 twilio API 接收短信。我生成了一个单独的回复控制器,它不处理我的路由或资源中的任何其他内容。它使用 post 方法与 twilio 进行通信。我得到了错误:
"ArgumentError (wrong number of arguments (given 1, expected 0)):"
replycontroller.rb
class ReplyController < ApplicationController
require 'twilio-ruby'
skip_before_action :verify_authenticity_token
def hart1
twiml = Twilio::TwiML::Response.new do |r|
r.Message 'The Robots are coming! Head for the hills!'
end
content_type 'text/xml'
twiml.text
end
end
这是我的路线
Rails.application.routes.draw do
resources :posts
resources :phones
resources :users
root 'home#index'
post "/reply/hart1" => "reply#hart1"
end
我的印象是我的路由不正确。 Heroku 控制台也给了我一个 500 错误,所以我知道这对我来说是可以修复的。
【问题讨论】:
标签: ruby-on-rails ruby twilio