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?
谁能告诉我哪里出了问题吗?
1 个解决方案
#1
5
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. Try:
该错误指示某处的某些代码正在期望一个字符串,但它正在获取一个符号,当它在符号上调用.tr()时,它将产生错误。试一试:
key_inside = CGI::unescape(key.to_s)
#1
5
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. Try:
该错误指示某处的某些代码正在期望一个字符串,但它正在获取一个符号,当它在符号上调用.tr()时,它将产生错误。试一试:
key_inside = CGI::unescape(key.to_s)