diff --git a/ruby/sqlcommenter-ruby/README.md b/ruby/sqlcommenter-ruby/README.md index 26380a40..2ca1b82f 100644 --- a/ruby/sqlcommenter-ruby/README.md +++ b/ruby/sqlcommenter-ruby/README.md @@ -1 +1,19 @@ -# sqlcommenter-ruby \ No newline at end of file +# SQLCommenter in Ruby + +## SQLCommenter support in Rails + + +Support for [SQLCommenter](https://google.github.io/sqlcommenter/) in [Ruby on Rails](https://rubyonrails.org/) varies, depending on your versions of Rails. + +If you are on Rails version: + + - **7.1 and above:** SQLCommenter is supported by default. Enable [query_log_tags](https://guides.rubyonrails.org/configuring.html#config-active-record-query-log-tags-enabled), and SQLCommenter formatting will be [enabled by default](https://edgeguides.rubyonrails.org/configuring.html#config-active-record-query-log-tags-format). + - **7.0:** Enable [query_log_tags](https://guides.rubyonrails.org/configuring.html#config-active-record-query-log-tags-enabled) and install the [PlanetScale SQLCommenter gem](https://github.com/planetscale/activerecord-sql_commenter#installation) for SQLCommenter support. + - **Below 7.0:** Refer to the [sqlcommenter_rails gem](https://github.com/google/sqlcommenter/tree/master/ruby/sqlcommenter-ruby/sqlcommenter_rails) in this directory for adding SQLCommenter support. Note that this requires additional work because you will have to install a fork of the [marginalia](https://github.com/basecamp/marginalia/) gem, which has since been consolidated into Rails 7.0 and up. + +## Tracing support in Rails + +Tracing support has been implemented in the [marginalia-opencensus gem]: https://github.com/google/sqlcommenter/tree/master/ruby/sqlcommenter-ruby/marginalia-opencensus. Note that this only works for Rails versions below 7.0, before the [marginalia](https://github.com/basecamp/marginalia/) gem was consolidated into Rails. + +Re-purposing that gem for Rails versions >=7.0 should only require minor modifications (contributions are welcome!). + diff --git a/ruby/sqlcommenter-ruby/sqlcommenter_rails/README.md b/ruby/sqlcommenter-ruby/sqlcommenter_rails/README.md index dc30dd3d..f8f57ef8 100644 --- a/ruby/sqlcommenter-ruby/sqlcommenter_rails/README.md +++ b/ruby/sqlcommenter-ruby/sqlcommenter_rails/README.md @@ -1,5 +1,7 @@ # sqlcommenter_rails +**If you are on Rails version 7.0 and up, refer to the [sqlcommenter-ruby README] instead** + [sqlcommenter] for [Ruby on Rails]. Powered by [marginalia] and [marginalia-opencensus]. @@ -8,6 +10,7 @@ Powered by [marginalia] and [marginalia-opencensus]. [Ruby on Rails]: https://rubyonrails.org/ [marginalia]: https://github.com/basecamp/marginalia/ [marginalia-opencensus]: https://github.com/google/sqlcommenter/tree/master/ruby/sqlcommenter-ruby/marginalia-opencensus +[sqlcommenter-ruby README]: https://github.com/google/sqlcommenter/tree/master/ruby/sqlcommenter-ruby ## Installation diff --git a/ruby/sqlcommenter-ruby/sqlcommenter_rails_demo/README.md b/ruby/sqlcommenter-ruby/sqlcommenter_rails_demo/README.md index cdb5e2aa..9c7491ec 100644 --- a/ruby/sqlcommenter-ruby/sqlcommenter_rails_demo/README.md +++ b/ruby/sqlcommenter-ruby/sqlcommenter_rails_demo/README.md @@ -1,9 +1,12 @@ # sqlcommenter_rails demo +**If you are on Rails version 7.0 and up, refer to the [sqlcommenter-ruby README] instead** + This is a demo [Rails API] application to demonstrate [sqlcommenter_rails] integration. [Rails API]: https://guides.rubyonrails.org/api_app.html [sqlcommenter_rails]: https://github.com/google/sqlcommenter/ruby/sqlcommenter-ruby/sqlcommenter_rails +[sqlcommenter-ruby README]: https://github.com/google/sqlcommenter/tree/master/ruby/sqlcommenter-ruby ## Setup