mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-15 00:24:09 +01:00
be8ae01ba4
Also: add advanced accounting to plans
24 lines
557 B
Ruby
24 lines
557 B
Ruby
# frozen_string_literal: true
|
|
|
|
# A special plan associated which can be associated with some users (with role 'partner')
|
|
# These partners will be notified when the subscribers to this plan are realizing some actions
|
|
class PartnerPlan < Plan
|
|
resourcify
|
|
|
|
before_create :assign_default_values
|
|
|
|
def partners
|
|
User.joins(:roles).where(roles: { name: 'partner', resource_type: 'PartnerPlan', resource_id: id })
|
|
end
|
|
|
|
def partner_id
|
|
partners.first.id
|
|
end
|
|
|
|
private
|
|
|
|
def assign_default_values
|
|
assign_attributes(is_rolling: false)
|
|
end
|
|
end
|