mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
b68e47a0ea
Previsouly, the reservation was expecting parameters like: slots_attributes: [{start_at: date, end_at: date, availability_id: number}] Now, the reservation is expecting simpler parameters like: slots_reservations_attributes:[{slot_id: number}]
11 lines
369 B
Ruby
11 lines
369 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Check that the current subscription's plan matches the subscribing user's plan
|
|
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
|