Skip to content

Commit 67742ab

Browse files
committed
Add callback to set new post creator as author
1 parent 98de2d8 commit 67742ab

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/models/better_together/post.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class Post < ApplicationRecord
3131
validates :content,
3232
presence: true
3333

34+
# Automatically grant the post creator an authorship record
35+
after_create :add_creator_as_author
36+
3437
def to_s
3538
title
3639
end

0 commit comments

Comments
 (0)