Rails: How do I print the request parameters?

后端 未结 8 1646
挽巷
挽巷 2020-12-13 06:11

I have a Rails 3 application and I want to print in the view the request parameters. How do I do it?

Edit:

The purpose is to see what is being sent in a Form

8条回答
  •  孤城傲影
    2020-12-13 06:41

    If you wanted to print all of the parameters, the easiest way would be to use the inspect

    puts params.inspect
    

    or better, use the Rails logger

    Rails.logger.debug params.inspect
    

    In your html/ERB, you can use

    <%= params.inspect %>
    

提交回复
热议问题