1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-04 15:24:23 +01:00
fab-manager/app/models/event_price_category.rb

18 lines
330 B
Ruby
Raw Normal View History

2016-08-24 12:30:48 +02:00
class EventPriceCategory < ActiveRecord::Base
belongs_to :event
belongs_to :price_category
2016-08-25 14:13:30 +02:00
has_many :tickets
2016-08-25 14:13:30 +02:00
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
2016-08-24 12:30:48 +02:00
end