rails-debug-request-params

  • Trying to understand how a legacy app is set up?
  • Don’t know what you are looking at?

Try inspecting all the requests by adding params.to_yaml or params.inspect or debug(params) or params.to_unsafe_h to your layout file:

#app/views/layouts/application.html.erb

  <body>
    <%= params.to_yaml %>
    <%= params.inspect %>
    <%= debug(params) %>
    <%= params.to_unsafe_h %>
    <hr>
    <%= yield %>
  </body>

For example, <%= params.inspect %> will give you

 #<ActionController::Parameters {"controller"=>"inboxes", "action"=>"edit", "id"=>"4"} permitted: false> 

<%= params.to_unsafe_h %> will give you

 {"controller"=>"inboxes", "action"=>"edit", "id"=>"4"} 

<%= debug(params) %> will give you (BEST)

 #<ActionController::Parameters {"controller"=>"inboxes", "action"=>"edit", "id"=>"4"} permitted: false> 

Source: Debugging Rails Applications