Skip to content

Commit

Permalink
Added description and author_id methods to Note
Browse files Browse the repository at this point in the history
Added description and author_id (author_ip already exists) methods to Note model. They still use first comment (but will be soon replaced to use records from Note model).
  • Loading branch information
nenad-vujicic committed Jan 13, 2025
1 parent 5d76ec0 commit 1cc0e59
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/models/note.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,22 @@ def freshly_closed_until
closed_at + DEFAULT_FRESHLY_CLOSED_LIMIT
end

# Return the author object, derived from the first comment
# Return the note's description, derived from the first comment
def description
RichText.new("text", comments.first.body)
end

# Return the note's author object, derived from the first comment
def author
comments.first.author
end

# Return the author IP address, derived from the first comment
# Return the note's author ID, derived from the first comment
def author_id
comments.first.author_id
end

# Return the note's author IP address, derived from the first comment
def author_ip
comments.first.author_ip
end
Expand Down

0 comments on commit 1cc0e59

Please sign in to comment.