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_category.rb
2020-03-25 12:35:09 +01:00

17 lines
374 B
Ruby

class PriceCategory < ApplicationRecord
has_many :event_price_category
has_many :events, through: :event_price_categories
validates :name, :presence => true
validates :name, uniqueness: {case_sensitive: false}
validates :conditions, :presence => true
def safe_destroy
if event_price_category.count == 0
destroy
else
false
end
end
end