[英]CGI::unescape giving error undefined method `tr'
I am trying to execute this line of code 我正在尝试执行此行代码
key_inside = CGI::unescape(key)
val_inside = CGI::unescape(val)
and its giving me error like 它给了我错误
undefined method `tr' for :oauth_consumer_key:Symbol\n
I am using Rails 2.3.18 and ruby 1.9.3 我正在使用Rails 2.3.18和ruby 1.9.3
Can any one please suggest as to what could be going wrong? 有人可以建议出什么问题吗?
The error indicates that some code somewhere is expecting a String but it is getting a Symbol, and when it calls .tr()
on the Symbol, it produces the error. 该错误表明某个地方的某些代码期望使用String,但是正在获取Symbol,并且在Symbol上调用.tr()
时,它将产生错误。 Try: 尝试:
key_inside = CGI::unescape(key.to_s)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.