I love being able to easily print datastrucutres into the stdout, tools like [`pretty-print`](http://ruby-doc.org/stdlib-2.0.0/libdoc/pp/rdoc/PP.html) are great for this:

```
[8] pry(main)> foo
=> {"utf8"=>"", "authenticity_token"=>"0G0OwiWMK3CRmEdOlmxgNA5VrIIm7/iHg21AOLaSywEPnDGHTtGLcLjSATY7BN5lzucIrdCwbv9M+Nw++2tuYg==", "q"=>"foobar", "commit"=>"Some submit button", "controller"=>"statics", "action"=>"create"}
[9] pry(main)> p foo
{"utf8"=>"", "authenticity_token"=>"0G0OwiWMK3CRmEdOlmxgNA5VrIIm7/iHg21AOLaSywEPnDGHTtGLcLjSATY7BN5lzucIrdCwbv9M+Nw++2tuYg==", "q"=>"foobar", "commit"=>"Some submit button", "controller"=>"statics", "action"=>"create"}
=> {"utf8"=>"", "authenticity_token"=>"0G0OwiWMK3CRmEdOlmxgNA5VrIIm7/iHg21AOLaSywEPnDGHTtGLcLjSATY7BN5lzucIrdCwbv9M+Nw++2tuYg==", "q"=>"foobar", "commit"=>"Some submit button", "controller"=>"statics", "action"=>"create"}
[10] pry(main)> pp foo
{"utf8"=>"",
 "authenticity_token"=>
  "0G0OwiWMK3CRmEdOlmxgNA5VrIIm7/iHg21AOLaSywEPnDGHTtGLcLjSATY7BN5lzucIrdCwbv9M+Nw++2tuYg==",
 "q"=>"foobar",
 "commit"=>"Some submit button",
 "controller"=>"statics",
 "action"=>"create"}
=> {"utf8"=>"", "authenticity_token"=>"0G0OwiWMK3CRmEdOlmxgNA5VrIIm7/iHg21AOLaSywEPnDGHTtGLcLjSATY7BN5lzucIrdCwbv9M+Nw++2tuYg==", "q"=>"foobar", "commit"=>"Some submit button", "controller"=>"statics", "action"=>"create"}

```

Is there some tool that would let me pretty-print something into a view or the flash? For example, if I'm in the `Statics#create`

```
def create
  flash[:notice] = params.inspect
  redirect_to statics_url
end

```

Then the rendered html looks like:

[![enter image description here](https://i.stack.imgur.com/PePd7.png)](https://i.stack.imgur.com/PePd7.png)

Is there an easy way to pretty print the params so they show up in my view or flash?

I've tried using `pretty_inspect`:

application.html.erb:

```
<body>
  <% if flash[:notice] %>
    <%= render plain: flash[:notice] %>
  <% end %>
  <%= yield %>
</body>

```

statics\_controller.rb:

```
def create
  flash[:notice] = params.pretty_inspect 
  redirect_to statics_url
end

```

But it didn't work:

[![enter image description here](https://i.stack.imgur.com/VRBVN.png)](https://i.stack.imgur.com/VRBVN.png)

Using `debug` also renders a non-pretty hash:

```
<body>
  <%= debug(params) if Rails.env.development? %>
  <%= debug(flash[:notice]) if Rails.env.development? %>
  <%#= debug(@collection) if Rails.env.development? %>
  <%#= debug(current_user) if Rails.env.development? %>
  <%= yield %>
</body>

```

[![enter image description here](https://i.stack.imgur.com/8UTZu.png)](https://i.stack.imgur.com/8UTZu.png)

Edit
----

Is there a better way than `gsub`bing?:

```
<%= debug(flash[:notice].inspect.gsub(',', ",\n").gsub('\\','')) if Rails.env.development? %>

```

[![enter image description here](https://i.stack.imgur.com/hKVAr.png)](https://i.stack.imgur.com/hKVAr.png)