【发布时间】:2013-04-24 07:44:37
【问题描述】:
我有两个 Rails 应用程序在不同的端口上运行。我正在尝试从一个应用程序使用另一个应用程序的 API。 这是 APP_1 中 Product.rb 模型的代码。
class Product < ActiveResource::Base
self.site = "https://localhost:3000"
self.ssl_options = {:cert => OpenSSL::X509::Certificate.new(File.open(pem_file)),
:key => OpenSSL::PKey::RSA.new(File.open(pem_file)),
:ca_path => "/path/to/OpenSSL/formatted/CA_Certs",
:verify_mode => OpenSSL::SSL::VERIFY_PEER}
end
我为 Product 模型设置了控制器和路由。当我运行 APP_1 我得到 p>
undefined local variable or method `pem_file' for Product:Class
谁能告诉我如何写一个pem文件,什么是pem文件?
【问题讨论】:
标签: ruby ruby-on-rails-3 api openssl activeresource