Search code examples
ruby-on-railsrubyrails-console

Object doesn't support #inspect


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.


Solution

  • Not necessarily a full answer to this question but we tried using the pry gem instead of IRB.

    gem 'pry-rails'
    

    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