Ruby 外部 URL 通过 HTTP,POST 到项目上 notify 这个 action 的参数,怎么获取到?

kevin_he · 2016年04月07日 · 最后由 kevin_he 回复于 2016年04月07日 · 2031 次阅读

这是 route 设置

resources :conts do
    collection do
      post 'notify'
    end
  end

这个是 notify 方法

require 'logger'
class ContsController < ApplicationController
  def union_notify
    logger = Logger.new(STDERR)
    notify_params = params.except(*request.path_parameters.keys)
    logger.debug notify_params
  end
end

报错

Parameters: {"accNo"=>"D4qC4YMtOm+fKvWi9qn4D46a2UIyeM8H2jtWWEXsmvZbxn/lsFYeL3ZxmFNEjQb9FPAP4VLn+ZA/xHwZ2N4fwma4LntuzEp9o0fa91ys+a9na3UYjg5uiSBATODIMZGs4hm1wc4NMQLTzM4ERMYkDvLIWWKGo1wLIlJt4aVn+Ms=", "signature"=>"bXYf2GC55SeOvrkGsiBCa+RYh8lFzl1xfD0/RlX9WFP5gKVf2AOXxdS0wjflLAMdS4jkxfIR5jSLZeJ+DVV2Rx4JLRraplSfQeURi2tpmJkjdiAcNCDyrEIveDZnz3CmZr2u90dx8+a7ll3LiPWLlDhqtJfw1oDB/XvA/eF/akQBy6MF0yJRUDRihluwJBlBF0rDz+nxIZ1w20+bVUJAMmJPRUtVv5KYzvjqsPP4leFg2g0v1tN9nJtIZvdkZAzL3UIzMBLN+5FdvPd8x9SaWpPn8pCEzpD0pEi3DUvWzmdwtghzXUaXcwTbtTNF4LF9a1CVGkPCktGMl+16lb/XNQ=="}
I, [2016-04-07T10:00:33.799721 #27786]  INFO -- : Completed 500 Internal Server Error in 51ms
F, [2016-04-07T10:00:33.802137 #27786] FATAL -- : 
ActionView::MissingTemplate (Missing template conts/notify, application/notify with {:locale=>[:en], :formats=>[:html, :text, :js, :css, :ics, :csv, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :slim, :coffee]}. Searched in:
* "/home/deployer/releases/101/app/views"

不是都取到了么!都打印出来了

现在的问题是没有正确返回页面内容

ActionView::MissingTemplate (Missing template conts/notify, application/notify with {:locale=>[:en], :formats=>[:html, :text, :js, :css, :ics, :csv, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :slim, :coffee]}. Searched in:
* "/home/deployer/releases/101/app/views"
params['accNo']

#2 楼 @huacnlee 哦哦,好的,我把方法写完整试试,谢谢

需要 登录 后方可回复, 如果你还没有账号请 注册新账号