Skip to content

Commit

Permalink
GITBOOK-18: No subject
Browse files Browse the repository at this point in the history
  • Loading branch information
gitbook-bot committed Aug 18, 2024
1 parent 5fb65ec commit f6b95a2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/guides/active-record-with-cql/belongsto.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ end

Next, we'll define the `Post` and `Comment` structs in CQL.

**Post Model**
### **Post Model**

```crystal
crystalCopy codestruct Post
Expand All @@ -73,7 +73,7 @@ crystalCopy codestruct Post
end
```

**Comment Model**
### **Comment Model**

```crystal
crystalCopy codestruct Comment
Expand Down Expand Up @@ -101,7 +101,7 @@ In the `Comment` model, we specify the `belongs_to :post` association, which lin

Now that we have defined the `Post` and `Comment` models with a `belongs_to` relationship, let's see how to create and query records in CQL.

**Creating a Post and Comment**
### **Creating a Post and Comment**

```crystal
# Create a new Post
Expand All @@ -115,7 +115,7 @@ comment.savex
* The post record is created and saved in the database.
*  And the returned id is then associtated to the comment.

**Querying the Associated Post from a Comment**
### **Querying the Associated Post from a Comment**

Once we have a comment, we can retrieve the associated post using the `belongs_to` association.

Expand Down

0 comments on commit f6b95a2

Please sign in to comment.