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

17 lines
374 B
Ruby
Raw Normal View History

2020-03-25 10:16:47 +01:00
class PriceCategory < ApplicationRecord
2016-08-24 12:30:48 +02:00
has_many :event_price_category
has_many :events, through: :event_price_categories
2016-08-24 16:52:37 +02:00
validates :name, :presence => true
validates :name, uniqueness: {case_sensitive: false}
validates :conditions, :presence => true
2016-08-24 12:30:48 +02:00
def safe_destroy
if event_price_category.count == 0
destroy
else
false
end
end
end