Questions tagged [awesomeprint]

24 questions
19
votes
6 answers

Can't get awesome_print gem to work

awesome_print looks like a pretty nice gem, so I wanted to try it out. I went to one of my projects and did: gem install awesome_print and it says one gem installed, documentation installed, etc. Then, while I am in that project, I went to my Rails…
user1899082
15
votes
1 answer

prettify JSON output of active-model-serializer in rails console

I am testing active-model-serializer output in the rails console and I am looking for a way to prettify the output. The the only solution I have found so far is: ap JSON.parse(ProfileSerializer.new(p).to_json) That seems like a roundabout approach.…
errata
  • 23,596
  • 2
  • 22
  • 32
8
votes
1 answer

How do I get Ruby awesome_print to file?

I am trying to get awesome_print to output to a file rather than the console but I cant find out how to do this? require "awesome_print" mySymbolizedHash = {'blah' => 'blabbbb', 'this' => 'that'} This will write to console, I need to write the…
7
votes
1 answer

awesome_print not showing associated objects

How do I get AwesomePrint.ap to show the associated objects that are nested inside an object? It doesn't do this by default and I'm assuming there's a way to force it?
jaydel
  • 14,389
  • 14
  • 62
  • 98
6
votes
1 answer

Format Params in Rails Server Logs

I have a webhooks controller, and i want to be able to view the params that get printed to my server logs in development in a nice readable format. Is awesome_print good for this? I'm trying to use prettyprint, example below, but the format is…
Michael Lee
  • 458
  • 1
  • 8
  • 18
6
votes
3 answers

How can I make awesome_print be the default in the heroku console?

How can I make awesome_print be the default in the heroku console? When I type Model.all in the console, I would like awesome_print to display the results without having to type ap Model.all.
webmagnets
  • 2,266
  • 3
  • 33
  • 60
4
votes
2 answers

Why doesn't Awesome Print work on some Rails collection objects?

Awesome Print generally works perfectly for me in Rails. But when doing ap Post.all in the Rails console I only get the standard full line output. Has it to do with the returned ActiveRecord_Relation class or something else, because when an array…
Fellow Stranger
  • 32,129
  • 35
  • 168
  • 232
3
votes
1 answer

Ruby's awesome_print to STDERR

How to make ap function (with its color) outputting to STDERR? ap bla # this goes to STDOUT
Kokizzu
  • 24,974
  • 37
  • 137
  • 233
2
votes
2 answers

awesome_print not printing in glorious color multiline layout?

I'm experiencing an issue wherein awesome_print is not displaying output in it's gorgeous colorized multiline format. What I find most curious is that while the gem is installed: $ gem install awesome_print …
ylluminate
  • 12,102
  • 17
  • 78
  • 152
2
votes
1 answer

how to get pretty printing from a form-encoded string

Good sirs. How can I force the request.body (or any other non-JSON string) to print out in a nice multi-lined JSON or yaml style? I have seen fancy methods to convert such strings to real JSON but was hoping to avoid putting in another method. def…
dwilbank
  • 2,470
  • 2
  • 26
  • 37
2
votes
1 answer

How do you disable awesome_print once enabled in IRB or rails console?

I have awesome_print configured to be my default formatter in IRB (using AwesomePrint.irb! in my .irbrc) and while this is normally awesome, I want to turn it off sometimes. Anybody know how to from a running IRB/Rails console?
bheeshmar
  • 3,125
  • 1
  • 19
  • 18
1
vote
2 answers

Permanently add a directory to Ruby $LOAD_PATH

I'd like the option to use awesome_print in every IRB console or Rails console. The IRB console is pretty much working satisfactorily right now. If I run irb, I can type require 'awesome_print' and it works. The Rails console isn't as easy. require…
Jason Swett
  • 43,526
  • 67
  • 220
  • 351
0
votes
1 answer

Why am I getting strong parameter errors in the Rails Console in rails 5?

I want to call this in my console (ap is the awesome print gem): ap Purchase.last(10) but I get this error: ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash It works like this: irb(main):020:0> ap…
pixelearth
  • 13,674
  • 10
  • 62
  • 110
0
votes
1 answer

How to use Awesome Print to format REST Client logs?

When using REST Client I can log calls to a text file using : RestClient.log = 'log.txt' Which gives useful but messy output such as: RestClient.get "https://dog.ceo/api/breeds/list/all", "Accept"=>"*/*", "Accept-Encoding"=>"gzip, deflate",…
dwkns
  • 2,369
  • 4
  • 22
  • 35
0
votes
2 answers

How do I get awesome_print to work without using ~/.irbrc file?

I want to use awesome print without putting it in my rails 5 app. Just in the console. The documentation for requiring it in irb is not working.
CJ Jean
  • 971
  • 1
  • 8
  • 10
1
2