拜读了用 Rails 搭建微信公众平台 API之后发现,
params[:xml]这个办法在Rails 4里面已经被办掉了,于是就看了一下Rails 4的新特性发现XML Parameter parsing has been sent to a plugin.
http://www.rubydoc.info/github/rails/actionpack-xml_parser
actionpack-xml_parser
A XML parameters parser for Action Pack (removed from core in Rails 4.0)
Installation
Include this gem into your Gemfile:
gem ‘actionpack-xml_parser‘
Then, add ActionDispatch::XmlParamsParser
middleware after ActionDispatch::ParamsParser
in config/application.rb
:
config.middleware.insert_after ActionDispatch::ParamsParser, ActionDispatch::XmlParamsParser
//*********************************************************************************************
Then, add ActionDispatch::XmlParamsParser
middleware after ActionDispatch::ParamsParser
in config/application.rb
:
config.middleware.insert_after ActionDispatch::ParamsParser, ActionDispatch::XmlParamsParser
如图:
时间: 2025-01-02 06:52:06