Skip to content

Commit

Permalink
Convert Entryable comment definition to HTML table
Browse files Browse the repository at this point in the history
  • Loading branch information
zzak committed Mar 13, 2023
1 parent 3025eaa commit 1b4ea69
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions guides/source/association_basics.md
Expand Up @@ -2857,18 +2857,18 @@ end

With this definition complete, our `Entry` delegator now provides the following methods:

```ruby
Entry#entryable_class # => Message or Comment
Entry#entryable_name # => "message" or "comment"
Entry.messages # => Entry.where(entryable_type: "Message")
Entry#message? # => true when entryable_type == "Message"
Entry#message # => returns the message record, when entryable_type == "Message", otherwise nil
Entry#message_id # => returns entryable_id, when entryable_type == "Message", otherwise nil
Entry.comments # => Entry.where(entryable_type: "Comment")
Entry#comment? # => true when entryable_type == "Comment"
Entry#comment # => returns the comment record, when entryable_type == "Comment", otherwise nil
Entry#comment_id # => returns entryable_id, when entryable_type == "Comment", otherwise nil
```
| Method | Return |
|---|---|
| `Entry#entryable_class` | Message or Comment |
| `Entry#entryable_name` | "message" or "comment" |
| `Entry.messages` | `Entry.where(entryable_type: "Message")` |
| `Entry#message?` | Returns true when `entryable_type == "Message"` |
| `Entry#message` | Returns the message record, when `entryable_type == "Message"`, otherwise `nil` |
| `Entry#message_id` | Returns `entryable_id`, when `entryable_type == "Message"`, otherwise `nil` |
| `Entry.comments` | `Entry.where(entryable_type: "Comment")` |
| `Entry#comment?` | Returns true when `entryable_type == "Comment"` |
| `Entry#comment` | Returns the comment record, when `entryable_type == "Comment"`, otherwise `nil` |
| `Entry#comment_id` | Returns entryable_id, when `entryable_type == "Comment"`, otherwise `nil` |

### Object creation

Expand Down

0 comments on commit 1b4ea69

Please sign in to comment.