拜读了用 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
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
如图:
gem permission denied
当gem install 时,会在 用户目录建立.gem目录。
而这个目录没加你当前用户的权限,
是只有SYSTEM权限,
于是添加用户权限就行了, 或者 Start Command Prompt with Ruby启动时, 以管理员的身份启动打开 。。