Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby on Rails documentation updates #169

Merged
merged 1 commit into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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