1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/app/models/price.rb

12 lines
395 B
Ruby
Raw Normal View History

2019-09-10 11:46:14 +02:00
# frozen_string_literal: true
# Store customized price for various items (Machine, Space), depending on the group and on the plan
2020-03-25 10:16:47 +01:00
class Price < ApplicationRecord
2016-03-23 18:39:41 +01:00
belongs_to :group
belongs_to :plan
belongs_to :priceable, polymorphic: true
validates :priceable, :group_id, :amount, presence: true
2019-09-10 11:46:14 +02:00
validates :priceable_id, uniqueness: { scope: %i[priceable_type plan_id group_id] }
2016-03-23 18:39:41 +01:00
end