Skip to content

Commit 08ee615

Browse files
authored
[ci skip] Fix example in active_record_basics.md doc (rails#52770)
The example code is: Book.find_by(title: "Metaprogramming Ruby 2") Instead of: Book.find_by(author: "J.R.R. Tolkien") Also add comments in SQL to make it clearer which calls create the queries. Co-authored-by: Petrik de Heus <[email protected]>
2 parents 6812949 + 385f0ec commit 08ee615

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

guides/source/active_record_basics.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,10 @@ book = Book.find(42)
493493
The above resulting in this SQL:
494494

495495
```sql
496-
SELECT "books".* FROM "books" WHERE "books"."author" = ? LIMIT ? [["author", "J.R.R. Tolkien"], ["LIMIT", 1]]
496+
-- Book.find_by(title: "Metaprogramming Ruby 2")
497+
SELECT "books".* FROM "books" WHERE "books"."title" = ? LIMIT ? [["title", "Metaprogramming Ruby 2"], ["LIMIT", 1]]
497498

499+
-- Book.find(42)
498500
SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT ? [["id", 42], ["LIMIT", 1]]
499501
```
500502

0 commit comments

Comments
 (0)