Fix circle max of account #23

This commit is contained in:
KMY 2023-09-23 20:08:02 +09:00
parent 0513db12ab
commit 77297b43bd

View file

@ -24,6 +24,6 @@ class Circle < ApplicationRecord
validates :title, presence: true
validates_each :account_id, on: :create do |record, _attr, value|
record.errors.add(:base, I18n.t('lists.errors.limit')) if List.where(account_id: value).count >= PER_ACCOUNT_LIMIT
record.errors.add(:base, I18n.t('lists.errors.limit')) if Circle.where(account_id: value).count >= PER_ACCOUNT_LIMIT
end
end