{"repo":"kvokka/pp_sql","free":true,"listed":false,"github":"https://github.com/kvokka/pp_sql","clone":"git clone https://github.com/kvokka/pp_sql.git","description":"Rails ActiveRecord SQL queries log beautifier","language":"Ruby","stars":274,"topics":["formatter","sql","rails-log","beautify","beautifier"],"license":"MIT","category":"databases-storage","readme_excerpt":"PpSql [![Version][rubygems badge]][rubygems] [![Codacy Badge][codacy badge]][codacy] [![Reviewed by Hound][hound badge]][hound] img src=\"https://api.gitsponsors.com/api/badge/img?id=78002099\" height=\"20\" Replace standard ActiveRecord#to sql method with [ anbt-sql-formatter ][anbt-sql-formatter-link] gem for pretty SQL code output in console. Rails log will be formatted also. Example output: ![log][log-img] Or in console ![console][console-img] Require Ruby 3.1+ Rails Rails / ActiveRecord 7.1+ (optional), will be injected automatically Legacy You can use version 0.2 of this gem with Ruby 2.2, 2.3 and/or Rails 4.0, 4.1 Usage for easy and clean usage with custom string you can use: Installation add in Gemfile And then execute: With other formatters If you are pry user, or use custom output formatter, use puts for output whitespaces, like puts User.all.to sql , or use User.all.pp sql . With Rails If you do not want to rewrite default #to sql method you may specify PpSql.rewrite to sql method=false in initializers. You can also disable log formatting by specifying PpSql.add rails logger formatting=false in initializers. Add to Application record I found usefull this trick: Supported by [![jetbrains][jetbrains-img-link]][jetbrains-link] Contributing Running the tests requires sqlite. To refresh the generated appraisal gemfiles: To run the maintained dependency matrix locally: GitHub Actions runs the Rails / ActiveRecord 7.1 , 7.2 , 8.0 , and 8.1 matrix on Ruby 3.2 , 3.3 , and 3.4 .","default_branch":null,"files":null,"tree":[],"storefront":"/r/kvokka","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/kvokka/pp_sql/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}