简体   繁体   English

CGI :: unescape提供错误的未定义方法`tr'

[英]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.

相关问题 ActionView :: Template :: Error(nil:NilClass的未定义方法`tr' - ActionView::Template::Error (undefined method `tr' for nil:NilClass Rails表单给出了未定义的方法错误 - Rails form is giving undefined method error with_options条件给出未定义的方法错误 - with_options condition giving undefined method error 延迟作业给出未定义的方法错误 - Delayed Job giving a undefined method error Rails用户类对方法无响应,给出未定义的方法错误 - Rails user class no responding to method, giving undefined method error Rails验证错误消息未显示,并提供未定义的方法错误 - Rails validation error message is not showing and is giving undefined method error Rails omniauth和常规登录,给出未定义的方法错误 - Rails omniauth and regular login, giving an undefined method error Rake任务在读取文件时出现未定义的方法错误 - Rake Task Giving Undefined Method Error When Reading File Rails嵌套的属性给出错误:未定义的方法“ build_priority” - Rails nested attributes giving error: undefined method `build_priority' Rails 测试给我一个错误“未定义的方法 'body'” - Rails test giving me an error of “undefined method 'body' ”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM