nas/app/models/circle_status.rb
KMY(雪あすか) df3b3f4185
Add circle posts history support (#18)
* Wip: make web backend

* Wip: keep statuses if edit circle

* Wip: Add circle history page and record circle posts

* Add circle post to history in web ui when post

* Add test
2023-09-24 13:01:09 +09:00

26 lines
589 B
Ruby

# frozen_string_literal: true
# == Schema Information
#
# Table name: circle_statuses
#
# id :bigint(8) not null, primary key
# circle_id :bigint(8)
# status_id :bigint(8) not null
# created_at :datetime not null
# updated_at :datetime not null
#
class CircleStatus < ApplicationRecord
belongs_to :circle
belongs_to :status
validates :status, uniqueness: { scope: :circle }
validate :account_own_status
private
def account_own_status
errors.add(:status_id, :invalid) unless status.account_id == circle.account_id
end
end