Calling controller or request in the debug console generates an endless stream of characters

When I try to debug something and want to see the current context I sometimes call inspect on the controller. This results in an endless stream of output that doesn’t seem to stop.

#<SessionsController:0x00007fa4969c7b50 @_action_has_layout=true, @rendered_format=nil, @_routes=nil, @_request=#<ActionDispatch::Request:0x00007fa4959310e8 @env={"rack.version"=>[1, 3], "rack.errors"=>#<IO:/dev/ttys012>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"puma 4.3.5 Mysterious Traveller", "GATEWAY_INTERFACE"=>"CGI/1.2", "REQUEST_METHOD"=>"GET", "REQUEST_PATH"=>"/users/sign_in", "REQUEST_URI"=>"/users/sign_in", "HTTP_VERSION"=>"HTTP/1.1", "HTTP_HOST"=>"127.0.0.1:64551", "HTTP_CONNECTION"=>"keep-alive", "HTTP_UPGRADE_INSECURE_REQUESTS"=>"1", "HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/81.0.4044.138 Safari/537.36", "HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "HTTP_SEC_FETCH_SITE"=>"none", "HTTP_SEC_FETCH_MODE"=>"navigate", "HTTP_SEC_FETCH_USER"=>"?1", "HTTP_SEC_FETCH_DEST"=>"document", "HTTP_ACCEPT_ENCODING"=>"gzip, deflate, br", "HTTP_ACCEPT_LANGUAGE"=>"en-US", "puma.request_body_wait"=>0, "SERVER_NAME"=>"127.0.0.1", "SERVER_PORT"=>"64551", "PATH_INFO"=>"/users/sign_in", "REMOTE_ADDR"=>"127.0.0.1", "puma.socket"=>#<TCPSocket:fd 34, AF_INET, 127.0.0.1, 64551>, "rack.hijack?"=>true, "rack.hijack"=>#<Puma::Client:0x3fd2483f76b8 @ready=true>, "rack.input"=>#<Puma::NullIO:0x00007fa49072f8f8>, "rack.url_scheme"=>"http", "rack.after_reply"=>[], "puma.config"=>#<Puma::Configuration:0x00007fa4958b3a80 @options=#<Puma::UserFileDefaultOptions:0x00007fa4958b3918 @user_options={:Host=>"127.0.0.1", :Port=>64551, :workers=>0, :daemon=>false,.......
1 Like

hahaha, I’m sorry about this! :laughing: Can you send a patch that shortens the inspect output on controller instances? I would be happy to merge a patch that fixes this. (I can do it too, but I don’t want to take away the opportunity)

2 Likes

I’ll create a PR :slight_smile:

Aaron, I’ve created a PR. Is this what you had in mind? https://github.com/rails/rails/pull/39439