crispgm/holy-images

View on GitHub
app/models/like.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Like < ApplicationRecord
  STATUS_LIKE = 0
  STATUS_UNLIKE = 1

  belongs_to :user
  belongs_to :image

  has_many :notifications, as: :event

  default_scope do
    where(status: STATUS_LIKE)
    order(updated_at: :desc)
  end
end