1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/app/validators/subscription_group_validator.rb
Sylvain c7a59c8cb7 WIP: refactoring to singularize the booking process
We need to achieve only one process for all booking, not one for subscription, one for reservations, etc.
Moreover we must store one object per invoice_item/payment_schedule_object and stop using Invoice.invoiced or PaymentSchedule.scheduled
2021-05-21 18:25:18 +02:00

8 lines
257 B
Ruby

class SubscriptionGroupValidator < ActiveModel::Validator
def validate(record)
return if record.statistic_profile&.group_id == record.plan&.group_id
record.errors[:plan_id] << "This plan is not compatible with the current user's group"
end
end