Skip to content

Commit

Permalink
Document SQL and IRB comment styles
Browse files Browse the repository at this point in the history
  • Loading branch information
zzak committed Mar 24, 2023
1 parent 097f703 commit 0dde0b5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions guides/source/api_documentation_guidelines.md
Expand Up @@ -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)
# # => #<Customer id: 10, first_name: "Ryan">
```

Booleans
--------

Expand Down

0 comments on commit 0dde0b5

Please sign in to comment.