如何获取尝试的网址和标题信息?

时间:2013-01-02 04:34:28

标签: ruby rest activeresource

我正在尝试连接到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等,也可以输出?

0 个答案:

没有答案