It seems like the Rails console limits its character output to about 880 characters. How do I remove this limitation?
Printing large objects, or text fields from the database, gives output like this:
=> #<User id: ....
system_password: ni
(...
inserted for brevity. The output contains lots and lots of text.)
You can see that the output is truncated / capped/ limited, so that nothing after 'ni' is displayed (should have been atleast an 'l', for 'nil').
This is so annoying. It doesn't allow me to fully inspect the string / text fields in the DB that contain a lot of text.
I presume it must be a setting somewhere, but I can't seem find it.
How do I remove this limitation, so I can see all of the text output?
I don't think irb or the Rails console is the problem. This doesn't truncate from either plain irb or rails c
:
(1..100000).reduce(''){|a,i| a << i.to_s}
The Rails console output is coming from the inspect
method, so it's probably ActiveRecord that is doing the truncation (code here). You should be able to override the inspect
method in your User model if you want custom output.