mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-03-14 00:50:14 -04:00
Helper to create reply relationship with post
This commit is contained in:
parent
d7219a6fbc
commit
ba4eaa0297
1 changed files with 8 additions and 0 deletions
|
@ -493,4 +493,12 @@ class Post < ActiveRecord::Base
|
|||
self.quoted_post_numbers ||= []
|
||||
self.quoted_post_numbers << num
|
||||
end
|
||||
|
||||
def create_reply_relationship_with(post)
|
||||
return if post.nil?
|
||||
post_reply = post.post_replies.new(reply_id: id)
|
||||
if post_reply.save
|
||||
Post.update_all ['reply_count = reply_count + 1'], id: post.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue