From 0dde0b56e7c3630d62034e5aeefca495566d4b3a Mon Sep 17 00:00:00 2001 From: zzak Date: Fri, 24 Mar 2023 17:59:42 +0900 Subject: [PATCH] Document SQL and IRB comment styles --- guides/source/api_documentation_guidelines.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/guides/source/api_documentation_guidelines.md b/guides/source/api_documentation_guidelines.md index 8a195ecc42ecb..5b51038afd177 100644 --- a/guides/source/api_documentation_guidelines.md +++ b/guides/source/api_documentation_guidelines.md @@ -162,6 +162,29 @@ On the other hand, regular comments do not use an arrow: # polymorphic_url(record) # same as comment_url(record) ``` +### SQL + +When documenting SQL statements, the result should not have `=>` before the output. + +For example, + +```ruby +# User.where(name: 'Oscar').to_sql +# # SELECT "users".* FROM "users" WHERE "users"."name" = 'Oscar' +``` + +### IRB + +When documenting the behavior for IRB, Ruby's interactive REPL, always prefix commands with `irb>` and the output should be prefixed with `=>`. + +For example, + +``` +# Find the customer with primary key (id) 10. +# irb> customer = Customer.find(10) +# # => # +``` + Booleans --------