feat(models): extend claim with Claim and Comment
This commit is contained in:
1 parent
4015436e50
commit
6a702a1ece
5 files changed
+156
No files matched your search
@@ -0,0 +1,10 @@
|
||||
class Like < Prism::Orm::Model
|
||||
belongs_to :user
|
||||
belongs_to :likeable, polymorphic: true, counter_cache: true
|
||||
|
||||
# Same reasoning as Comment#acts_as_paranoid - a trashed post's likes (and
|
||||
# a trashed post's comments' own likes) come back with it on restore.
|
||||
acts_as_paranoid
|
||||
|
||||
validates :user_id, presence: true, uniqueness: { scope: %i[likeable_id likeable_type] }
|
||||
end
|
||||
Reference in new issue
Block a user