awesome-print / awesome_print

Pretty print your Ruby objects with style -- in full color and with proper indentation
http://github.com/michaeldv/awesome_print
MIT License
4.08k stars 454 forks source link

Pry output is not formatted correctly #128

Closed AHaymond closed 11 years ago

AHaymond commented 11 years ago

Output in Pry is not formatted as it should be:

screen shot 2013-08-02 at 10 28 40 am

Whereas output in the Rails console for the same object is formatted as:

screen shot 2013-08-02 at 10 29 10 am

My .pryrc file includes the following in order to load awesome_print as the default formatter:

begin
  require 'awesome_print'
  AwesomePrint.pry!
rescue LoadError => err
  puts "no awesome_print :("
end

My versions are:

ehutzelman commented 11 years ago

Update: Turns out the best way to handle this is to just use the "pry-rails" gem

I saw this same issue and I think it has to do with how we are loading pry with rails (pry -r ./config/environment). Try putting this in your .irbrc file to override irb with pry and start the rails console normally:

begin
  require "pry"
  Pry.start
  exit
rescue LoadError => e
  warn "=> Unable to load pry"
end