How to get nice formatting in the Rails console

前端 未结 12 1415
一生所求
一生所求 2020-12-12 10:50

I want to get something like this to look nice:

>> ProductColor.all
=> [#

        
12条回答
  •  醉梦人生
    2020-12-12 11:11

    To add to Alter Lago's suggestion for using AwesomePrint, If you can't/shouldn't/don't want to add the awesome_print gem to your project's Gemfile, do this:

    gem install awesome_print

    Edit ~/.irb.rc and add this:

    $LOAD_PATH << '/Users/your-user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/awesome_print-1.1.0/lib'

    require 'awesome_print'

    (Making sure the path and version are correct, of course)

提交回复
热议问题