Skip to content

Commit

Permalink
Ruby on Rails documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
modulitos committed Dec 8, 2022
1 parent a6bfea7 commit 3c81a73
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
20 changes: 19 additions & 1 deletion ruby/sqlcommenter-ruby/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
# sqlcommenter-ruby
# 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!).

3 changes: 3 additions & 0 deletions ruby/sqlcommenter-ruby/sqlcommenter_rails/README.md
Original file line number Diff line number Diff line change
@@ -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].
Expand All @@ -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

Expand Down
3 changes: 3 additions & 0 deletions ruby/sqlcommenter-ruby/sqlcommenter_rails_demo/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 3c81a73

Please sign in to comment.