使用https时,rails发布表单问题

时间:2013-05-14 10:44:59

标签: ruby-on-rails-3 forms https

以下是我的代码,我正在尝试将表单发布到https网站。我多次用Google搜索,没有运气。

post_params = {
               name: "Peter",
               age: "26",
               school: "St. Andrew Secondary"
             }
uri = URI.parse('https://www.somehttps.com')
http = Net::HTTP.new(uri, "443")
http.use_ssl = true
http.post_form(uri, post_params)

但我总是得到:

NoMethodError (undefined method `post_form' for #<Net::HTTP www.somehttps.com:443 open=false>)

为什么会这样?请帮帮我,谢谢。

1 个答案:

答案 0 :(得分:0)

尝试 - Net :: HTTP.post_form(uri,post_params)