Fix circle max of account #23
This commit is contained in:
parent
0513db12ab
commit
77297b43bd
1 changed files with 1 additions and 1 deletions
|
@ -24,6 +24,6 @@ class Circle < ApplicationRecord
|
||||||
validates :title, presence: true
|
validates :title, presence: true
|
||||||
|
|
||||||
validates_each :account_id, on: :create do |record, _attr, value|
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue