对象不支持#inspect
在 ruby 控制台中运行简单任务时遇到问题。 如果我运行,
user = User.find(10)
User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", "10"], ["LIMIT", 1]]
(Object doesn't support #inspect)
我会收到“对象不支持#inspect”错误。我的同事有完全相同的分支机构,没有问题。在其他分支机构我也没有这个问题。肯定有一个结果,像这样运行就可以了。
user.first_name
=> "Tom"
我什至删除了分支,重新下载,但仍然遇到同样的问题。已删除 gemfile,捆绑...尝试了我所知道的一切。我什至打开和关闭了笔记本电脑。
Getting an issue when running simple tasks in the ruby console.
If I run
user = User.find(10)
User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", "10"], ["LIMIT", 1]]
(Object doesn't support #inspect)
I get an 'Object doesn't support #inspect' error. My colleague has the exact same branch and has no issue. On other branches I don't have this issue either. There is definitely a result as running things like this are fine.
user.first_name
=> "Tom"
I have even deleted the branch, re-downloaded but still getting the same issue. Have removed the gemfile, bundled... tried everything I know. I even turned my laptop on and off.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不一定是这个问题的完整答案,但我们尝试使用 pry gem 而不是 IRB。
将其添加到我们的开发组中,现在使用 pry 而不是 irb。没有问题。
一定是IRB存在某种腐败行为。我们使用的版本是1.3.5
Not necessarily a full answer to this question but we tried using the pry gem instead of IRB.
Added this to our development group and now uses pry instead of irb. No issues.
Must be some sort of corruption on IRB. The version we were using was 1.3.5