【问题标题】:Showing POST parameters in Rails ActiveResource在 Rails ActiveResource 中显示 POST 参数
【发布时间】:2012-06-01 22:52:18
【问题描述】:

我正在使用ActiveResource 从外部 API 获取和发布资源。即使在日志中我可以看到正在执行的调用,但我看不到参数。默认情况下不应该打印参数哈希吗?

我应该如何/添加什么才能看到它们?

【问题讨论】:

    标签: ruby-on-rails-3 rest params activeresource


    【解决方案1】:

    ActiveResource Post 调用语法为:

    post(your_custom_method_name, options={}, body='')
    

    这里options是查询参数

    例如:

    Customer.post(:bulk_import, {}, { new_customers: new_customers}.to_json)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-24
      相关资源
      最近更新 更多