Skip to content

Commit 36ce7d3

Browse files
authored
Ruby on Rails documentation updates (#169)
1 parent a6bfea7 commit 36ce7d3

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

ruby/sqlcommenter-ruby/README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
# sqlcommenter-ruby
1+
# SQLCommenter in Ruby
2+
3+
## SQLCommenter support in Rails
4+
5+
6+
Support for [SQLCommenter](https://google.github.io/sqlcommenter/) in [Ruby on Rails](https://rubyonrails.org/) varies, depending on your versions of Rails.
7+
8+
If you are on Rails version:
9+
10+
- **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).
11+
- **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.
12+
- **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.
13+
14+
## Tracing support in Rails
15+
16+
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.
17+
18+
Re-purposing that gem for Rails versions >=7.0 should only require minor modifications (contributions are welcome!).
19+

ruby/sqlcommenter-ruby/sqlcommenter_rails/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# sqlcommenter_rails
22

3+
**If you are on Rails version 7.0 and up, refer to the [sqlcommenter-ruby README] instead**
4+
35
[sqlcommenter] for [Ruby on Rails].
46

57
Powered by [marginalia] and [marginalia-opencensus].
@@ -8,6 +10,7 @@ Powered by [marginalia] and [marginalia-opencensus].
810
[Ruby on Rails]: https://rubyonrails.org/
911
[marginalia]: https://github.com/basecamp/marginalia/
1012
[marginalia-opencensus]: https://github.com/google/sqlcommenter/tree/master/ruby/sqlcommenter-ruby/marginalia-opencensus
13+
[sqlcommenter-ruby README]: https://github.com/google/sqlcommenter/tree/master/ruby/sqlcommenter-ruby
1114

1215
## Installation
1316

ruby/sqlcommenter-ruby/sqlcommenter_rails_demo/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# sqlcommenter_rails demo
22

3+
**If you are on Rails version 7.0 and up, refer to the [sqlcommenter-ruby README] instead**
4+
35
This is a demo [Rails API] application to demonstrate [sqlcommenter_rails] integration.
46

57
[Rails API]: https://guides.rubyonrails.org/api_app.html
68
[sqlcommenter_rails]: https://github.com/google/sqlcommenter/ruby/sqlcommenter-ruby/sqlcommenter_rails
9+
[sqlcommenter-ruby README]: https://github.com/google/sqlcommenter/tree/master/ruby/sqlcommenter-ruby
710

811
## Setup
912

0 commit comments

Comments
 (0)