mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
18 lines
330 B
Ruby
18 lines
330 B
Ruby
class EventPriceCategory < ActiveRecord::Base
|
|
belongs_to :event
|
|
belongs_to :price_category
|
|
|
|
has_many :tickets
|
|
|
|
validates :price_category_id, presence: true
|
|
validates :amount, presence: true
|
|
|
|
before_destroy :verify_no_associated_tickets
|
|
|
|
protected
|
|
def verify_no_associated_tickets
|
|
tickets.count == 0
|
|
end
|
|
|
|
end
|