0

我正在尝试连接到 Web 服务端点,但我不知道如何调试它,我的代码是:

require 'rubygems'
require 'active_resource'

class Project < ActiveResource::Base
  class << self
    attr_accessor :auth_token
  end

  def save
    prefix_options[:auth_token] = self.class.auth_token
    super
  end
end

Project.site = 'http://example.com:8080/api/v1'
Project.format = :json
Project.auth_token = 'aaa1112222333'
p = Project.new(:name => 'pizza time 1')
p.save

我收到以下错误:

gems/ruby-1.9.3-p194@testing/gems/activeresource-3.2.9/lib/active_resource/connection.rb:130:in `handle_response': Failed.  Response code = 400.  Response message = Bad Request. (ActiveResource::BadRequest)

如果它是 POST 或 GET 等,我如何输出请求的确切 url?

4

0 回答 0