So today while at work I was trying to debug a bit of code and see the contents of an Ruby object, which is a simple enough task. I used the 'inspect' method to print a string representation of the object, this worked perfectly and I was able to see all the attributes of the object in the console. Then later tonight I was working on Shoutreel and used 'inspect' again, but this time in the View, something that I had never really tried before, and to my surprise it failed to print a string representation of the object. A hash sign was printed out. Why is this?
So is this a bug in Rails, does the 'inspect' method in the view not work for model objects? My guess is that the inspect method in ActiveRecord, which is what the model object inherits from, has a bug. I'll investigate this and write back soon.This is the code I had in the view:<%= reel.inspect %><%= [ 1, 2, 3..4, 'five' ].inspect %>The top line printed the hash, while the bottom line printed out the array as a string.