1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-13 23:48:55 +01:00
fab-manager/app/validators/subscription_group_validator.rb

8 lines
255 B
Ruby
Raw Normal View History

2016-04-07 12:28:25 +02:00
class SubscriptionGroupValidator < ActiveModel::Validator
def validate(record)
2019-06-05 07:52:02 +02:00
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"
2016-04-07 12:28:25 +02:00
end
end