Added description and author_id methods to Note
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).
This commit is contained in:
parent
5d76ec051e
commit
f3fc4cdb49
1 changed files with 12 additions and 2 deletions
|
@ -82,12 +82,22 @@ class Note < ApplicationRecord
|
||||||
closed_at + DEFAULT_FRESHLY_CLOSED_LIMIT
|
closed_at + DEFAULT_FRESHLY_CLOSED_LIMIT
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return the author object, derived from the first comment
|
# Return the note's description, derived from the first comment
|
||||||
|
def description
|
||||||
|
comments.first.body
|
||||||
|
end
|
||||||
|
|
||||||
|
# Return the note's author object, derived from the first comment
|
||||||
def author
|
def author
|
||||||
comments.first.author
|
comments.first.author
|
||||||
end
|
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
|
def author_ip
|
||||||
comments.first.author_ip
|
comments.first.author_ip
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue