mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
12 lines
404 B
Ruby
12 lines
404 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Store customized price for various items (Machine, Space), depending on the group and on the plan
|
|
class Price < ApplicationRecord
|
|
belongs_to :group
|
|
belongs_to :plan
|
|
belongs_to :priceable, polymorphic: true
|
|
|
|
validates :priceable, :group_id, :amount, presence: true
|
|
validates :priceable_id, uniqueness: { scope: %i[priceable_type plan_id group_id duration] }
|
|
end
|