【问题标题】:Zerigo DNS gem incompatible with ActiveResource 3.1Zerigo DNS gem 与 A​​ctiveResource 3.1 不兼容
【发布时间】:2011-08-24 20:04:50
【问题描述】:

我正在使用 zerigo_dns 1.2.0 gem (https://github.com/twilson63/zerigo_dns),它需要使用 ActiveResource 进行“请求”调用。它在 Rails 3.0.4 上运行良好,因为默认格式是 XML。但是 Rails 3.1.0.rc4 默认使用 JSON 并导致问题,因为 Zerigo 期待 application/xml mime-type。

任何人都知道如何有效地切换到使用 XML 作为默认格式?

【问题讨论】:

    标签: ruby-on-rails xml json format activeresource


    【解决方案1】:

    Zerigo::DNS::Base 继承自 ActiveResource。你应该能够做到

    Zerigo::DNS::Base.format = :xml
    

    【讨论】:

      【解决方案2】:

      让它与这个猴子补丁一起工作:

      class Zerigo::DNS::Base
       def self.format
        self._format || ActiveResource::Formats::XmlFormat
       end
      end
      

      【讨论】:

        猜你喜欢
        • 2023-03-25
        • 1970-01-01
        • 2013-07-14
        • 2015-10-31
        • 2014-08-16
        • 1970-01-01
        • 2021-06-25
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多